Just a quick post on another problem I ran into while setting up PaperClip. When attempting to submit a form WITHOUT an image I received the following error message:
Assets asset /tmp/stream20120218-22611-dgnkr-0.exe is not recognized by the 'identify' command.
Apparently the most common cause of this issue is one of two things:
#1: You don’t have RMagick installed
The easiest fix for this is to simply install the rmagick gem. Simply add rmagick to your Gemfile and run bundle install. Restart your server and you should be ready to go.
#2: Your command_path isn’t set correctly
Run the following command from your console:
chris@chris-VirtualBox:~/site$ which identify /usr/bin/identify
Then add the path that is returned to your environment settings:
Paperclip.options[:command_path] = "/usr/bin"
#3: If all else fails
If none of the above seem to be causing your issue, try adding the following to your model:
def asset? !(asset_content_type =~ /^image.*/).nil? end
This will simply prevent the file being processed if it’s not an image, avoiding the issue all together. Hopefully this’ll help someone out, let me know if you come across any other solutions.
UPDATE:
Apparently a more recent cause of this issue is an update to the cocaine gem, rolling back to version 0.3.2 appears to resolve the issue. Thanks to Ahmed and Fabrice for bringing it to my attention:
https://github.com/thoughtbot/paperclip/issues/1038
http://stackoverflow.com/a/12760881/522859
The command_path should point to the directory, I guess (not to the identify binary).
Since paperclip is also using other ImageMagick commands like convert
Paperclip.options[:command_path] = “/usr/bin”
LikeLike
Sorry about the late reply, you’re right about the path – have fixed it up now. Thanks for letting me know!
LikeLike
Hi,
I am having the same problem of “photo is not recognized by the identify command”,but the fact is I have gone through all possible solutions from internet still no luck.
I have installed my ImageMagick properly also added the Rmagick gem.
My command_path is also right and nor I am processing a blanck image field.
I would be glad if you could help me with this problem.?
Thank you in advance.
LikeLike
It may also come from a Cocaine gem version issue, see there : https://github.com/thoughtbot/paperclip/issues/1038
LikeLike
http://stackoverflow.com/questions/12750737/image-file-is-not-recognized-by-the-identify-command-heroku
LikeLike