Wednesday, March 1, 2017

Laravel - show images from public folder with specified name

I want to display all images with specified id.

Ex: i just wanna display all images with same id before underscore.

how i do that? I have this,

Route::get('images/{filename}', function ($filename) {

$path = public_path('uploads') . '/' . $filename;

$file = File::get($path);
$type = File::mimeType($path);

$response = Response::make($file, 200);
$response->header("Content-Type", $type);

return $response;

});

image from folder




via D. Lopes

Advertisement