1
votes

I've got a problem with ImageMagick and Paperclip.

I'm using on localhost rails3, ruby1.9.2, imagemagick 6.5.8 and paperclip as gem in version 2.3.8.

On production (server) I have rails3, roby1.9.2, imagemagick 6.6.7-4 and the same paperclip as above.

When uploading photos on localhost everything is fine.

But on server my problem appear. It gets error:

[paperclip] identify -format %wx%h '/tmp/stream20110204-15633-3wdd5s.jpg[0]' 2>/dev/null

[paperclip] An error was received while processing:

Paperclip::NotIdentifiedByImageMagickError: /tmp/stream20110204-15633-3wdd5s.jpg is not recognized by the 'identify' command.

(the last paragraph is in brackets but I don't know how to avoid hiding it).

Anyone know what's going on?

edit:

All the time I search for some solve and seems that it is problem with ImageMagick. I uploaded some .jpg file on server and try run command "identify file.jpg" and... there is an error:

identify: no decode delegate for this image format `file.jpg' @ error/constitute.c/ReadImage/532.

hmm...

2

2 Answers

1
votes

Possibly Paperclip doesn't know where to find the ImageMagick binaries. Have you tried setting up an initializer for Paperclip in config/initializers/paperclip.rb ?

Set:

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

On your system you might need /usr/local/bin, or something else entirely. You can find out where the 'identify' binary and other ImageMagick binaries are located by typing:

which identify

If the answer is /usr/bin/identify, then you know to set image_magick_path to /usr/bin

0
votes

If adding Paperclip.options[:command_path] = "/usr/local/bin/" doesn't work try installing ImageMagick with common delegates:

mkdir /sources cd /sources

wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz

tar xvfz ImageMagick.tar.gz

cd ImageMagick-6.6.7-8

Here comes the part makes difference

./configure --disable-static --with-modules --without-perl --without-magick-plus-plus --with-quantum-depth=8

make

sudo make install