How can I get AWS S3 image as streaming view?
Now I can see image as following url:
<img src="https://s3.us-east-1.amazonaws.com/my-bucket/image.png" />
I want to get like this:
<img src="https://myproject.com/upload/image.png" />
I tried as following but it didn't work. My route:
Route::get('/upload/{path_to_image}', 'FileController@getImage')->where('path', '(.*)');
-My Controller
public function getImage($disk, $path)
{
$headers = array(
'Content-Type: application/image',
);
if(Storage::disk("s3")->exists($path))
{
$file = Storage::disk("s3")->path($path);
return response()->file($file, $headers);
}
abort(404);
}
Any suggestion would be appreciated!