我的模特:
has_attached_file :avatar, :styles => { :thumb => "65x65>" },
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
:bucket => "doweet-image",
:path => ":attachment/:id/:style.:extension"
当我将图像上传到亚马逊s3并将其放在视图上时:
<%= image_tag(current_user.avatar.url(:small))%>
照片没有显示,当我复制链接src照片时,这是:
http://s3.amazonaws.com/doweet-image/avatars/1/small.jpg?1311356386
当我去链接时,我遇到了这个错误:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>152EBFC9033E6633</RequestId>
<HostId>
Iw3zWXuCC6JjPAJig+pBVqQbLilN4dmTY4VooVO5CVKCH3O/MN3VDawXbI6Zd5NP
</HostId>
</Error>
答案 0 :(得分:2)
进入您的s3存储桶并确保您的文件夹具有对所有文件的读取权限。看起来它正在寻找图像,但没有读取权限。
如果您使用的是Mac,我建议传输,但我确信通过网络界面就足够了。