Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel show s3 image in blade template

Tags:

laravel

I have an image stored in an S3 bucket that is linked to my Laravel app. How can I display this image in a blade template?

So far I have...

<img src= "{{Image::make(Storage::disk('s3')->get('image/' . $filename))}}">

But this is not returning anything.

Does anybody have an example I can see?

like image 391
fightstarr20 Avatar asked Jan 28 '23 10:01

fightstarr20


1 Answers

The S3 driver has a url function that'll get you a temporary, signed URL to the S3 object, so all you'll need to do is:

<img src="{{ Storage::disk('s3')->url($filename) }}">
like image 99
ceejayoz Avatar answered Feb 08 '23 08:02

ceejayoz