I have application which is deployed to heroku using amazon s3 posting images to buckets.This works perfectly fine. But when fetching same image it gives error:
Errno::ENOENT (No such file or directory showing path s3.amazonaws.com/bucket_name/app/public/messages/images/000/000/061/thumb/images.jpeg?1362410115)
Same path copying and pasting in browser's url doesn't work. If I am using bucket name as end point it works ie, with following path
/bucket_name.s3.amazonaws.com/app/public/messages/images/000/000/061/thumb/images.jpeg?1362410115.
But I dont know how to configure this url in my model. I am following heroku's way to configure aws-sdk.
https://devcenter.heroku.com/articles/paperclip-s3
Model has_attached_file seems like i am missing something here.For rest of configuration you can check above link.
has_attached_file :image, :styles => { :medium => "100x100>", :thumb => "100x100>" }
Thanks
Including given code in config/initializers/paper_clip.rb resolved my problem.
Paperclip::Attachment.default_options.merge!(
:url => ':s3_domain_url',
:path => 'app/public/:class/:attachment/:id_partition/:style/:filename'
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With