我有一个应用程序,这是部署到heroku使用亚马逊s3发布图像到buckets.This完美的工作。但是,当获取相同的图像时,它会给出错误:
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)在浏览器的url中复制和粘贴相同的路径不起作用。如果我使用存储桶名称作为端点,那么它就可以工作,路径如下
/bucket_name.s3.amazonaws.com/app/public/messages/images/000/000/061/thumb/images.jpeg?1362410115.但是我不知道如何在我的模型中配置这个url。我遵循heroku的方法来配置aws-sdk。
https://devcenter.heroku.com/articles/paperclip-s3模型has_attached_file似乎我遗漏了一些东西here.For其余的配置,你可以检查上面的链接。
has_attached_file :image, :styles => { :medium => "100x100>", :thumb => "100x100>" }谢谢
发布于 2013-03-06 01:42:46
在config/initializers/paper_clip.rb中包含给定的代码解决了我的问题。
Paperclip::Attachment.default_options.merge!(
:url => ':s3_domain_url',
:path => 'app/public/:class/:attachment/:id_partition/:style/:filename'
)https://stackoverflow.com/questions/15220428
复制相似问题