Level 8
Hi man,I had the same problem, in your getUserImage() method, just use instead of return new Response($file, 200) write: return $file and it will work :) At least that worked for me.
Hi all, I am facing with a problem to retrieve my images from storage.At first i stored them in public and it works nice. Now i stored them in my upload function and they are not shown on the page:
public function upload(){
$file=$input['fileName'];
$fileName=$input['fileName']->getClientOriginalName();
$mime=$input['fileName']->getClientMimeType();
Storage::disk('local')->put($fileName,
File::get($file)
);
}
//and in my view to retrieve i used :
<img src="{{ route('album.image',['filename'=>fileName]) }}" alt="" class="img-responsive"/>
//So the route:
Route::get('/images/{filename}', [
'uses' => 'GalleryController@getUserImage',
'as' => 'album.image'
]);
public function getUserImage($filename)
{
$file = Storage::disk('local')->get($filename);
return new Response($file, 200);
}
Please or to participate in this conversation.