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"

Comments

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

  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. Jerome Avatar
    Jerome

    This issue has driven me mad. Thanx !!!

  3. Jeremy Pinnix Avatar
    Jeremy Pinnix

    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.

  4. Thanks! I lost half a day trying to figure that one out.

  5. Thanks for this.

  6. Joshua Sierles Avatar
    Joshua Sierles

    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.

  7. […] Paperclip, passenger and ?not recognized by the ?identif(…) about 1 month ago […]

  8. 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.

  9. Thanks for the info! Much appreciated

  10. […] Paperclip, passenger and "not recognized by the ?identify’ command" By Witold Rugowski of NetManiac 12 months ago. […]

  11. […] problem might be Paperclip not having it’s goodness on the path (https://nhw.pl/wp/2009/07/14/paperclip-passenger-identify-not-recogn…. It would also appear that adding command_path to the environment is the key. I’ve tried a few […]

  12. @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 ] }

  13. Oops, pressed enter too quickly.

    Add a simple video method:

    def video?
    [ ‘application/x-mp4’,
    ‘video/mpeg’,
    ‘video/quicktime’,
    ‘video/x-la-asf’].include?(source.content_type)
    end

    Original code from http://thewebfellas.com/blog/2009/2/22/video-thumbnails-with-ffmpeg-and-paperclip

Leave a Reply

Your email address will not be published. Required fields are marked *

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