我已经浏览了所有关于此的 SO 问题,但没有任何乐趣。
升级到 Mountain Lion 后出现以下错误:
Validation failed: Photo /var/folders/92/qp3ppxv92tsglvj03ndp0t6m0000gn/T/stream20121007-36927-1dzwbgk-0.jpeg is not recognized by the 'identify' command.
并在日志中
Command :: identify -format %wx%h :file
[paperclip] An error was received while processing: # <Paperclip::NotIdentifiedByImageMagickError: /var/folders/92/qp3ppxv92tsglvj03ndp0t6m0000gn/T/stream20121007-36927-1dzwbgk-0.jpeg is not recognized by the 'identify' command.>
我正在使用:Ruby 1.8.7、Rails 3.1.3、OSX Mountain Lion、Homebrew 来安装依赖项
我已经添加了
#development.rb
Paperclip.options[:command_path] = "/usr/local/bin"
我已经完全删除并重新安装了自制软件
#brew doctor
Your system is raring to brew.
#brew list
ack gettext imagemagick libffi libpng little-cms pkg-config readline
cmake git jasper liblqr libtiff mysql postgresql xz
freetype glib jpeg libmagic libyaml ossp-uuid qt
我在另一个 SO 案例的推荐下安装了 liblqr,这带来了很多依赖。
识别似乎可以从命令行工作
#identify /var/folders/92/qp3ppxv92tsglvj03ndp0t6m0000gn/T/stream20121007-36927-1dzwbgk-0.jpeg
/var/folders/92/qp3ppxv92tsglvj03ndp0t6m0000gn/T/stream20121007-36927-1dzwbgk-0.jpeg JPEG 259x195 259x195+0+0 8-bit DirectClass 11KB 0.000u 0:00.000
#identify -format %wx%h /var/folders/92/qp3ppxv92tsglvj03ndp0t6m0000gn/T/stream20121007-36927-1dzwbgk-0.jpeg
259x195
识别似乎可以从控制台工作
Loading development environment (Rails 3.1.3)
1.8.7 :001 > system("identify -format %wx%h /var/folders/92/qp3ppxv92tsglvj03ndp0t6m0000gn/T/stream20121007-36927-1dzwbgk-0.jpeg")
259x195
=> true
我已经安装了 rmagick - 虽然我以前从未使用过它。宝石:
*** LOCAL GEMS ***
paperclip (2.7.1)
rmagick (2.13.1)
我已经尝试了所有建议,现在完全没有想法。关于如何深入挖掘以隔离问题的任何建议?原因是由 Paperclip 导致调整 jpeg 或 PNG 文件的大小(我没有尝试过任何其他文件):
has_attached_file :photo,
:styles => {:thumb => "100x100", :medium => "x140", :mediumplus => "x210",:large => "960x378" },
:storage => :s3,
:s3_credentials => {
:access_key_id => ENV['S3_KEY'],
:secret_access_key => ENV['S3_SECRET']
},
:s3_protocol => "https",
:bucket => ENV['S3_BUCKET'],
:path => ":attachment/:id/:style.:extension"