سؤال

I am using the paperclip and aws-sdk gems to upload avatars to AWS, but when I render the photos in my application, the console gives me the following response:

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

Below are my codes:

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) %>

I went to the S3 console and checked my photos, they all have the content-type of image/jpeg. As I browsed around the internet, it looks like no one has really encountered this issue before, does anyone know what is going on?

Thank you.

هل كانت مفيدة؟

المحلول

This means, that something you get from S3 is not an image but often an error message in xml.

'puts' link to your photo into console and paste it to browser. You will see, that you have got not photo but an error message.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top