回形针图像重新处理,图像损坏和丢失

时间:2014-12-07 14:36:19

标签: ruby-on-rails amazon-s3 paperclip

我缺少生产数据。

我根据上传图片的模型更改了我的图片样式,以优化网站。我正在使用paperclip和s3进行存储。这是我使用的代码。

has_attached_file :attachment, styles: lambda {|attachment| {
  original: (

    attachment.instance.source_type.eql?("Trip")? ["1200x800>", 'jpg'] :
    attachment.instance.source_type.eql?("User")? ["200x200>", 'jpg'] : 
    attachment.instance.source_type.eql?("Milestone")? ["700x500>", 'jpg'] :
    attachment.instance.source_type.eql?("Moment")? ["700x500>", 'jpg'] :["10x10>", 'jpg']
  ),
  medium: (
    attachment.instance.source_type.eql?("Trip")? ["500x300>", 'jpg'] : ["10x10", 'jpg']
  )
}
}

这是我用于重新处理的命令。

Image.find_each { |image| image.attachment.reprocess!}

这在测试服务器上运行良好。所以,我在生产数据上使用了这个。现在,一些图像在生产中丢失,有些图像显示访问被拒绝。以下是您可以查看的几张图片网址,看看到底发生了什么:

http://s3.amazonaws.com/roadmojoproductionbucket/images/attachments/000/000/163/medium/IMG_132801219374746.jpg?1417959351 http://s3.amazonaws.com/roadmojoproductionbucket/images/attachments/000/000/164/original/IMG_133237947098173.jpg?1417959352

我该怎么做才能找回这些图片?

0 个答案:

没有答案