이미지 폴더를 보호하기 위해 'storage'폴더에 저장된 이미지를 표시하려고합니다. 내가이 매개 변수 위해 그것을 할 방법, 그 아래도이 코드를 작동하지 않습니다Laravel : 'storage'폴더에 저장된 이미지로드
경로 :
Route::get('img/users/{id}/logo/{image}', function($id = null, $image = null)
{
$path = storage_path().'/img/profils/'.$id.'/logo/'.$image;
if (file_exists($path)) {
return Response::download($path);
}
});
보기 :
src="{!!asset('img/users/'.$user->id.'/logo/'.$user->imagelogo)!!}"
오류 게시 – Sherif
어떻게 이해하지 못 하셨나요? – nabil
프로필로 이미지를 가져올 수 없지만이 경우 사용자의 ID를 설정하면 이미지 프로필이 표시됩니다. Route :: get ('img/users/2/logo/{image}', $/= 0, = null, $ image = null) { $ path = storage_path(). '/ img/profils/2/logo/'.$ 이미지 – nabil