I've a image and some text file in storage folder other than the public folder. the folder architecture is storage |->uploads
and set a route like
Route::get('storage/{folder}/{filename}','FileController@getFile');
inside the Controller the getFile method have following code
$path = storage_path($folder . DIRECTORY_SEPARATOR . $filename);
if (extension_loaded('fileinfo')) {
if (!File::exists($path)) {
abort(404);
}
$file = File::get($path);
$type = File::mimeType($path);
$response = Response::make($file, 200);
$response->header("Content-Type", $type);
return $response;
}
else{
abort(412,'please enable the fileinfo extension or contact site administration');
}
when i try to retrieve the image from url it return the blank image like this blank image
but when i try to retrive the text file it return the file
Also tried it with Image::make($path)
and response()->file($path)
when the mime type is image/* still the output is same..
so How do i show my image file from url without using the public folder