In my rails app I have used attachment_fu to upload images and stored it on s3. I want to display these images on browser without retrieving it. How can I display images by giving s3 path?
在我的rails应用程序中,我使用attachment_fu上传图像并将其存储在s3中。我想在浏览器中显示这些图像而不检索它。如何通过提供s3路径显示图像?
Thanks, Jayashri
谢谢,Jayashri
2 个解决方案
#1
3
You just need to link to the correct S3 path for you images.
您只需为映像链接到正确的S3路径。
For public files they are in the format:
公开档案的格式如下:
eg http://s3.amazonaws.com/[bucket]/[key]
If your content is private you'll need to create a signed url but all the SDKs and libraries make this easy.
如果您的内容是私有的,您将需要创建一个签名url,但是所有的sdk和库使这变得很容易。
Then use the url to display the images:
然后使用url显示图像:
<img src="http://s3.amazonaws.com/mybucket/myfile.jpg" ... ></img>
#2
0
It may help you to install the S3 organizer in Firefox so you can browser your directories. Then I believe the URL's are structured kinda like this...
它可以帮助您在Firefox中安装S3管理器,以便您能够浏览您的目录。我相信URL的结构是这样的…
http://BUCKET.s3.amazonaws.com/FOO/BAR.png
http://BUCKET.s3.amazonaws.com/FOO/BAR.png
#1
3
You just need to link to the correct S3 path for you images.
您只需为映像链接到正确的S3路径。
For public files they are in the format:
公开档案的格式如下:
eg http://s3.amazonaws.com/[bucket]/[key]
If your content is private you'll need to create a signed url but all the SDKs and libraries make this easy.
如果您的内容是私有的,您将需要创建一个签名url,但是所有的sdk和库使这变得很容易。
Then use the url to display the images:
然后使用url显示图像:
<img src="http://s3.amazonaws.com/mybucket/myfile.jpg" ... ></img>
#2
0
It may help you to install the S3 organizer in Firefox so you can browser your directories. Then I believe the URL's are structured kinda like this...
它可以帮助您在Firefox中安装S3管理器,以便您能够浏览您的目录。我相信URL的结构是这样的…
http://BUCKET.s3.amazonaws.com/FOO/BAR.png
http://BUCKET.s3.amazonaws.com/FOO/BAR.png