通过 PaperClip 上传到 s3 的图像未显示在我的 Rails 应用程序中

发布于 2024-10-09 05:52:11 字数 397 浏览 0 评论 0原文

我有一个 Rails 应用程序,允许用户通过回形针将照片上传到 s3。虽然上传工作正常,但当我尝试显示图像时,我看到的只是图像名称...

<%= image_tag @user.photo.url(:thumbnail) %> 

查看图像属性,网址为: http://s3.amazonaws.com/mybucket/thumbnail/imagename.png?12982847

如何使图像显示在 Rails 应用程序中? 以及如何更改/隐藏 s3 url?

谢谢~!

I have a rails app that allows users to upload photos via paperclip to s3. While uploading works fine, when I try to display the image all I see is the image name...

<%= image_tag @user.photo.url(:thumbnail) %> 

looking at the image properties the url is: http://s3.amazonaws.com/mybucket/thumbnail/imagename.png?12982847

How do I make my image display in my rails app?
and how do I change/hide the s3 url?

Thanks~!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

混浊又暗下来 2024-10-16 05:52:11

您需要设置 ACL

关于域名,您可以设置一个CNAME域名(可以是任何域名)这将指向您的 S3 存储桶

You need to set the ACL.

Regarding the domain, you can setup a CNAME domain (can be any domain) which will point to your S3 bucket.

深者入戏 2024-10-16 05:52:11

你用的是S3fox吗?如果是这样,请尝试设置该文件夹的权限,以便任何人都可以读取该文件

are you using S3fox? if so, try setting the permissions on the folder so that anyone can read the file

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文