views:

3012

answers:

3

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 recognized by the 'identify' command. and     
/tmp/stream20100103-13830-ywmerx-0 is not recognized by the 'identify' command.

I'm confident this is not related to ImageMagick because I've removed any image processing from the uploading, also I've tried uploading different mime types, like .txt files and the such.

Additionally, I found something that may work. A blog post claims that putting the following in my environment (in this case development.rb)

Paperclip.options[:command_path] = "/opt/local/bin"
+11  A: 

This is related to ImageMagick. The command_path option needs to point to the location where identify is installed. From the command line, you can determine this with which identify.

$ which identify
/some/path/to/identify

Afterwards, set command_path to that path (in config/environments/development.rb):

Paperclip.options[:command_path] = "/some/path/to"
Ryan McGeary
I have almost exactly this problem, except for one thing: the error just appears when I'm trying to attach videos! Any ideas? :(
Erik Escobedo
+1  A: 

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.

sunkil
+1  A: 

This worked fromhttp://arglebargle.posterous.com/path-environment-variable-for-rails-using-pas

Put something like this in the VirtualHost (or wherever passenger is set up):

SetEnv PATH /opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/mysql/bin
Les Freeman