0
내가 성공적으로 파일을 업로드하고 다음 코드로 해당 경로를 저장 렌더링보기 :Laravel 파일 업로드 경로와
/*Image Handling*/
$file = Input::file('profilePicture');
$destinationPath = public_path().'/images/';
$filename = $file->getClientOriginalName();
Input::file('profilePicture')->move($destinationPath, $filename);
//Profile image
$profileImg = $destinationPath.$filename;
은 내가 데이터베이스에 profileImg를 저장합니다. 이 모양은 다음과 같습니다.
/Applications/MAMP/htdocs/devproject/public/images/picture.jpeg
이제이 그림을보기 중 하나에 표시하고 싶습니다. 그래서 나는이 한 :
<a class="th" href="{{URL::to('/')}}">{{ HTML::image($details->profileImg, "work", array('style' => 'width:100px;height:100px;')) }}</a>
를이는 렌더링 방식이다 : 경로가 올바르지 않아
물론<a class="th" href="http://localhost:8888/devproject/index.php"><img src="http://localhost:8888/devproject/Applications/MAMP/htdocs/devproject/public/images/picture.jpeg" style="width:100px;height:100px;" alt="work"></a>
이 작동하지 않습니다하지만이 저장된 방법이다.
대신의/public/images/picture.jpeg
: 나는 할 이미지의 경로를 필요로하는 URL에 딱 맞는이 같은
/Applications/MAMP/htdocs/devproject/public/images/picture.jpeg
을하고 사진을 보여줍니다. 이를 달성하는 방법에 대한 조언은 감사하겠습니다. 사용하는 대신 자체 $details->profileImg
를 사용하는, 그리고
$profileImg = $filename;
:
asset('images/' . $details->profileImg)
예 :