尝试将png
保存到带回形针附件的模型时出现错误。“识别”命令无法识别Rails回形针`
我User
型号:
class User < ActieRecord::Base
attr_accessible :icon
has_attached_file :icon, :url => "/system/users/icon/:hash.:extension",
:hash_secret => "superSecretHashSecret",
:styles => { :medium => "300x300>", :thumb => "100x100>" }
end
试图设置图标示例:
u = User.last
u.icon = open(Rails.root + "spec/fixtures/files/example.png")
u.save
例模型误差:
:icon => ["/var/folders/43/810gn/T/example20121104-36855-1v7t136.png is not recognized by the 'identify' command."]
还有谁已经张贴了许多人类似的问题,尤其是this one,但没有一个e解决方案为我工作。
我command_path是否设置正确:
O:~ $ which identify
/usr/local/bin/identify
在development.rb
Paperclip.options[:command_path] = "/usr/local/bin/"
这可能仍然是,虽然这个问题。 当试图使用`直接出现以下错误鉴定:这到底是怎么回事
O:~ $ identify workspace/app/spec/fixtures/files/example.png
dyld: Library not loaded: /usr/lib/libltdl.7.dylib
Referenced from: /usr/local/bin/identify
Reason: image not found
Trace/BPT trap: 5
任何建议?
我曾尝试重新安装的ImageMagick
brew unlink imagemagick
brew install imagemagick
其他人推荐加入Rmagick
。这绝对不是使用回形针的要求,也没有帮助。
已提出的另一个解决方案是删除:style
属性。但这不是一个解决方案。我需要对图像进行处理。
我有Paperclip处理另一个模型在我的项目中处理文件不是图像/不做任何处理。所以我知道这可能与此有关。
有关如何解决此问题的其他建议?
感谢glebm。我通过直接与自制啤酒争论了一段时间(似乎这可能为我节省了麻烦)。 –
谢谢! magick-installer脚本为我工作。 – sq1020