views:

1692

answers:

3

I'm using paperclip to handle image uploads to rails. it worked fine on my dev OSX machine, but now on my web server I get this error:

[paperclip] /Users/marky/bin/identify '-format' '%wx%h' '/tmp/stream,16451,2.JPG[0]' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::CommandNotFoundError: Paperclip::CommandNotFoundError>
[paperclip] /Users/marky/bin/identify '-format' '%wx%h' '/tmp/stream,16451,2.JPG[0]' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::CommandNotFoundError: Paperclip::CommandNotFoundError>

Now it's clear to me the reason; identify is actually in /usr/bin/ not /Users/marky/bin/ which is from my dev machine. I have:

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

in my development.rb, but I'm still getting the error. I have no idea how to fix this, can anyone help?

+4  A: 

You can install ImageMagick on your machine. These problem generates because it will not find some methods.

To check ImageMagick is installed on your machine is simply run 'convert' command on terminal.

hi, thanks for your reply. yes I have ImageMagick installed on my machine. When I run the 'convert' command in the terminal it runs fine. any other ideas? it's clearly the path, but I have no idea how to change it.
Mark McFarlane
ah, but if I run 'identify' from the command line it also runs fine no matter what folder I run it from, does this mean there is another problem?
Mark McFarlane
+1  A: 

Install following packeges for working with imagemagick

1) apt-get install imagemagick.
2) apt-get install libmagickwand-dev
3) gem install rmagick

I think you are missing second one.

Dinesh Atoliya
apt-get install imagemagick Reading package lists... DoneBuilding dependency tree Reading state information... Doneimagemagick is already the newest version.The following packages were automatically installed and are no longer required: apache2-mpm-worker libapr1 libaprutil1-ldap apache2-utils apache2.2-common libaprutil1-dbd-sqlite3 apache2.2-bin ssl-cert libaprutil1Use 'apt-get autoremove' to remove them.0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Mark McFarlane
apt-get install libmagickwand-devReading package lists... DoneBuilding dependency tree Reading state information... Donelibmagickwand-dev is already the newest version.The following packages were automatically installed and are no longer required: apache2-mpm-worker libapr1 libaprutil1-ldap apache2-utils apache2.2-common libaprutil1-dbd-sqlite3 apache2.2-bin ssl-cert libaprutil1Use 'apt-get autoremove' to remove them.0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Mark McFarlane
gem install rmagickBuilding native extensions. This could take a while...Successfully installed rmagick-2.13.11 gem installedThanks! Just ran all the above. Does that mean rmagick was actually not installed?
Mark McFarlane
apt-get install imagemagick should be enough
knoopx
+3  A: 

If you are hosting your application with Passenger, keep in mind that Passenger does not have the same $PATH variable as your logged in user. A good way to check whether Passenger can see the ImageMagick commands is to add this to one of your erb templates:

<%= `which convert` %>
<%= `echo $PATH` %>

and to compare the results with running the same commands in your terminal. Another possibility is ImageMagick can't find the libs it needs. In this case, you may need to export another variable to let ImageMagick know where the libs are:

# my config/environments/development.rb
Paperclip.options[:command_path] = "DYLD_LIBRARY_PATH='/Users/jch/Library/ImageMagick-6.6.3/lib' /Users/jch/Library/ImageMagick-6.6.3/bin"

Hope that helps -jerry

Jerry Cheung
by the same token, you can just type in shell: heroku console %x{convert -version}+%x{which convert}
Comptrol
make sure you restart the server, after adding (or changing) the Paperclip.options[:command_path] to the environments/development.rb
gef