I am getting an error when trying to save a png to a model with a paperclip attachment.
My User model:
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
Example of trying to set an icon:
u = User.last
u.icon = open(Rails.root + "spec/fixtures/files/example.png")
u.save
Example model error:
:icon => ["/var/folders/43/810gn/T/example20121104-36855-1v7t136.png is not recognized by the 'identify' command."]
There are a number of people who have posted similar questions to this one, especially this one but none of those solutions work for me.
My command_path is set correctly:
O:~ $ which identify
/usr/local/bin/identify
In development.rb
Paperclip.options[:command_path] = "/usr/local/bin/"
This still might be the problem though.
When trying to use `identify directly I get the following error:
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
Any suggestions as to what is going on here?
I have tried reinstalling ImageMagick
brew unlink imagemagick
brew install imagemagick
Others have recommended adding Rmagick. It is definitely not a requirement for using Paperclip and it also did not help.
Another solution that has been suggested is removing the :style property. That isn’t a solution though. I need to do the processing on the images.
I have Paperclip working on another model in my project that handles documents that are not images/don’t do any processing. So I know that it is probably related to that.
Any other suggestions on how to address this problem?
The solution ended up being to install
libtool. This was the best suggestion here as well. My issue proved more complicated because ofhomebrewnot being up to date and in a state where it could not be updated without forcing a checkout of master.For people that face this issue in the future, I recommend manually checking that the
identifycommand actually works even if it is in your path.If it fails it will show something like:
In this case try installing
libtool.If this fails, run
brew update. If it continues to fail ensure that you have the latest Xcode installed and try updating again.You will know this worked if you can successfully use
identity. It will look something like this:The answer from glebm may very well have worked too. I have not taken a look at that installer.