ruby-on-rails – Paperclip错误 – NotIdentifiedByImageMagickError

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Paperclip错误 – NotIdentifiedByImageMagickError前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试用回形针将图像上传到aws s3,但是我收到了这个错误
Command :: file -b --mime '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-1u773ft.jpg'
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-1rep3kt.jpg[0]' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-1rep3kt.jpg[0]' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
Command :: file -b --mime '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-kfejir.jpg'

在我的模型中,我设置了这些样式

has_attached_file :photo,:storage => :s3,:s3_credentials => "#{Rails.root}/config/s3.yml",:path => "/:style/:id/:filename",:styles => { :medium => "300x300>",:thumb => "100x100>" },:default_url => "/assets/profile/iama.png"

当我删除这些样式时,一切正常,但我真的需要它们.

我正在使用Rails 3.2.16和

paperclip (4.1.1)
      activemodel (>= 3.0.0)
      activesupport (>= 3.0.0)
      cocaine (~> 0.5.3)
      mime-types

我已经安装了ImageMagick和rmagick gem

请帮帮我.

解决方法

问题是我的ImageMagick没有JPEG代表.我发现使用convert -list格式.所以我使用MacPorts重新安装了ImageMagick,并使用新的Paths to ImageMagick重新安装了rmagick.

猜你在找的Ruby相关文章