How to display an image that is stored on s3 without saving to the hard drive?

In my rails application, I used attachment_fu to upload images and save them to s3. I want to display these images in a browser without receiving it. How can I display images by specifying s3 path?

Thanks Jayashri

+3
source share
2 answers

You just need to set the link to the correct S3 path for the images.

For public files, they are in the format:

eg http://s3.amazonaws.com/[bucket]/[key]

If your content is private , you need to create a signed url , but all SDKs and libraries make it easy.

Then use url to display the images:

<img src="http://s3.amazonaws.com/mybucket/myfile.jpg"  ... ></img>
+3
source
0

Source: https://habr.com/ru/post/1784997/


All Articles