rails paperclip and passenger `is not recognized by the 'identify' command`

前端 未结 14 840
终归单人心
终归单人心 2020-11-28 06:37

When I upload a photo, my model fails validation, err well even without any validations I\'m returned this error:

/tmp/stream20100103-13830-ywmerx-0 is not r         


        
相关标签:
14条回答
  • 2020-11-28 07:14

    I was able to resolve this by doing the following:

    brew uninstall imagemagick
    brew install imagemagick
    
    0 讨论(0)
  • 2020-11-28 07:16

    Usually it helps to specify the path to the identify command with..

    Paperclip.options[:command_path] = "/your/path/to/identify"
    

    ..as the others mentioned. But the problem can also occur if there is a version mismatch, I recently updated the Ruby-on-Rails Version of an application (to Rails 3.1.10), but forgot to update the paperclip gem. After I updated the paperclip version to 2.8.0 it worked again.

    0 讨论(0)
  • 2020-11-28 07:17

    I got it working by installing brew, http://mxcl.github.com/homebrew/

    And then i typed:

    brew install imagemagick
    

    and after that

    gem install rmagick
    

    Then I just deleted the option paths (Paperclip.options[:command_path] = "...") that I typed in manually in environment/development.rb and initialize/paperclip.rb

    Added rmagick to gem file. Restarted the server and it worked like a charm!

    0 讨论(0)
  • 2020-11-28 07:17

    To add one more potential solution that I haven't seen discussed much: ldconfig.

    I had the same problem that I just spent a day and a half tracking down. I properly reinstalled ImageMagick from source with the additional png and jpeg support, I added LD_LIBRARY_PATH and DYLD_LIBRARY_PATH to the environment variables, I set the :command_path option for Paperclip in my production environment config. Although the ImageMagick commands worked from the command line, nothing fixed my Paperclip problem.

    Finally after seeing ldconfig mentioned in passing, I tried that on a whim, and it worked.

    sudo ldconfig
    

    I may have been able to accomplish the same thing by restarting apache or the hardware, but I wasn't in a position to do that on my own.

    0 讨论(0)
  • 2020-11-28 07:18

    This can also be caused by using fairly old versions of Paperclip (for example, version 2.4.x) with newer, incompatible versions of the Cocaine gem.

    0 讨论(0)
  • 2020-11-28 07:18

    If you're a mac user and this has only been a problem since updating your OS to 10.8 then it could be an X11 issue, as outlined here http://support.apple.com/kb/HT5293

    identify ~/path/to/image

    Was not working for me even after trying all the above fixes. I installed XQuartz from http://xquartz.macosforge.org/landing/ and now it is working again.

    May help others out too...

    0 讨论(0)
提交回复
热议问题