Paperclip, passenger and “not recognized by the ‘identify’ command”

If You do use awesome :) Paperclip library, and on application served by Passenger You get errors like:

Avatar /tmp/stream.1170.0 is not recognized by the 'identify' command.

most probably Passenger does not have setup environment and is missing a path. On FreeBSD identify is placed in /usr/local/bin and AFAIR this path is not included by default in PATH. As result Passenger can not find this utility.

You can try to setup environment for Passenger (Apache?) or just add in appropriate environment (in my case it was production.rb):

Paperclip.options[:command_path] = "/usr/local/bin"

Join the Conversation

13 Comments

  1. I hit the same problem not long ago. In my case it was Linux and a custom build of ImageMagick which ended up in /usr/local/bin. The solution is the same.

  2. I spent a ton of time trying to figure out why Paperclip stopped working for me. Reinstalling ImageMagick didn’t help. But this did! Thank you so much for this post.

  3. Seems like this issue happens if you try to upload a file that isn’t an image. The solution there is not to specify any thumbnail styles if you’re uploading videos.

  4. For windows, make sure you close down the rails server and any command prompt instances and restart them. The imagemagick install path in program files (the folder containing identify.exe) needs to be accessible in the PATH variable. To check type echo %PATH% in the command prompt. If the imagemagick installation folder shows, the rails app should function.

  5. @Joshua, Or you can tell paperclip to create thumbnail only if attachment is video.

    has_attached_file :source,
    :styles => {:custom => ‘120×68#’},
    :url => ‘/videos/:id/:style/:basename.:extension’,
    :path => ‘:rails_root/public/videos/:id/:style/:basename.:extension’,
    :processors => lambda { |a| a.video? ? [ :video_thumbnail ] : [ :thumbnail ] }

Leave a comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.