2016-11-06 2 views
0

나는 Laravel 5.3을 사용하고 있으며 Laravel Storage의 파일 이미지를 html/blade로 렌더링하는 데 문제가 있습니다.저장 장치에서 이미지 파일 표시

내 filesystems.php의 기본 드라이버

'default' => 'public' 

'저장'에서 파일 이미지를 렌더링하는 것은 보는 방법/HTML/블레이드

나는이 시도

,

//path for image from the storage 
Route::get('/app/system/sale-items/item/{username}/{item_id}/{image}', function($image,$item_id,$username) 
{ 
    $path = storage_path().'/app/public/'.$username.'/'.$item_id.'/'. $image; 
    if (file_exists($path)) { 
     return Response::download($path); 
    } 
}); 

하지만, 이미지가 보이지 않는 것처럼 작동하지 않습니다. '저장 장치'에서 이미지를 가져 오지 못합니다. 어떤 도움이나 아이디어를 주시겠습니까?

+0

가'도우미 https://laravel.com/docs/5.3/helpers#method-storage-path – meda

+0

같은 것을 시도 storage_path()'를 사용하려고 사용, 이미 알아 냈 이 Route :: get ('images/{filename}', function ($ filename) { return image :: make (storage_path(). '/'. $ filename) -> 응답(); }); –

답변

0

는 난 그냥

//path for image from the storage 
Route::get('/app/system/sale-items/item/{username}/{item_id}/{image}', function($username,$item_id,$image) 
{ 
    $path = storage_path().'/app/public/'.$username.'/'.$item_id.'/'. $image; 
    if (file_exists($path)) { 
     return Response::download($path); 
    } 
}); 
관련 문제