I have placed my uploads in the storage folder. Now, I want to display these uploads into my view. I have tried doing this:
view:
<img src="{{route("image_download", ['id' => Auth::guard('admin')->user()->AccountOfficerID, 'filename' => Session::get('avatar')] )}}" class=img-circle alt="Avatar" />
route:
Route::get('images/{id}/{$filename}', ['as' => 'image_download', function ($id, $filename)
{
$path = storage_path() . '/uploads/images/admins/' . $id . '/icon_size/' . $filename;
if (File::exists($path)) {
$type = File::mimeType($path);
return response()->download($path);
}
}]);
And other various methods I have searched. But none worked for me. I have checked the path and it is correct. However, it is not displaying any image at all. I hope someone could point me to the right track. Thank you.
EDIT There seems to be a 404 error in the browser console relating to the file. But I can access the file with the path returned through the browser.