samedi 3 janvier 2015

Getting Resource interpreted as Image but transferred with MIME type text/html

Just switched over to Refile for image uploads on my Rails application.


I have the uploads going directly to my s3 bucket. I have two buckets configured (with same settings), one for testing and one for production.


Everything in my local development works fine, and uploading to my bucket in production works, but on all the uploaded images I get the following when rendering them on a webpage.



Resource interpreted as Image but transferred with MIME type text/html:


Also in production, the images are not showing up.


I've looked into permissions for the buckets, but they seem to be good to go. I've also looked at others questions/answers regarding this warning, but have been unable to find any that pertain here.


If any code is needed please let me know.


config/initializers/refile.rb



require 'refile/backend/s3'

aws = {
access_key_id: Rails.application.secrets.aws['access_key_id'],
secret_access_key: Rails.application.secrets.aws['secret_access_key'],
bucket: Rails.application.secrets.aws['s3_bucket_name'],
use_ssl: true
}
Refile.cache = Refile::Backend::S3.new(max_size: 5.megabytes, prefix: 'cache', **aws)
Refile.store = Refile::Backend::S3.new(prefix: 'store', **aws)


Gist of the image helper



attachment_image_tag(avatar, :image, :fill, size, size)


Thanks for taking a look.





Aucun commentaire:

Enregistrer un commentaire