Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的 Rails 应用程序中,我使用 attachment_fu 上传图像并将其存储在 s3 上。我想在浏览器上显示这些图像而不检索它。如何通过提供 s3 路径来显示图像?
谢谢,贾亚什里
您只需为图像链接到正确的 S3 路径。
对于公共文件,它们的格式为:
eg http://s3.amazonaws.com/[bucket]/[key]
如果您的内容是私有的,您将需要创建一个签名的 url,但所有的 SDK 和库都让这很容易。
然后使用 url 显示图像:
<img src="http://s3.amazonaws.com/mybucket/myfile.jpg" ... ></img>
它可以帮助您在 Firefox 中安装 S3 管理器,以便您可以浏览您的目录。然后我相信 URL 的结构有点像这样......
http://BUCKET.s3.amazonaws.com/FOO/BAR.png