Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Errno::ENOENT (No such file or directory) in amazon-s3

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

like image 266
Chitrank Samaiya Avatar asked Nov 04 '22 03:11

Chitrank Samaiya


1 Answers

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'
    )
like image 95
Chitrank Samaiya Avatar answered Nov 09 '22 07:11

Chitrank Samaiya