2

我使用回形针和aws-sdk gems向AWS上传头像,但是当我在我的应用程序中渲染照片时,控制台给了我以下响应:将资源解释为图像,但使用MIME类型application/xml传输aws

Resource interpreted as Image but transferred with MIME type application/xml aws 

下面是我的代码:

development.rb

config.paperclip_defaults = { 
    :storage => :s3, 
    :s3_credentials => { 
    :bucket => "appname-development", 
    :access_key_id => "##########", 
    :secret_access_key => "##########" 
} 

user.rb

attr_accessible :profile_picture 

has_attached_file :profile_picture, 
    :styles => { 
     :big => '200x200>', 
     :small => '50x50#' 
} 

show.html.erb

<%= image_tag @user.profile_picture.url(:small) %> 

我去S3控制台,并检查了我的照片,它们都具有内容类型图像/ JPEG的。 当我浏览互联网时,看起来没有人真的遇到过这个问题,有人知道发生了什么事吗?

谢谢。

回答

2

这意味着,从S3获得的内容不是图像,而是xml中的错误消息。

将您的照片“放入”链接到控制台并粘贴到浏览器。你会看到,你没有照片,但有错误信息。

+1

对不起,那实际的修正是什么?我相信我遇到了同样的问题。 – KevinAdu

相关问题