Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paperclip / Passenger NotIdentifiedByImageMagickError:

When I try to upload a photo in Ruby on Rails using Paperclip on my local machine it works perfectly.

When I try to upload a photo in Ruby on Rails using Paperclip on our Linux (CentOS 5.2) server with Apache and Phusion Passenger, I get:

2 errors prohibited this user from being saved
There were problems with the following fields:
- Avatar /tmp/stream20091026-21120-1qdbnul-0 is not recognized by the 'identify' command.
- Avatar /tmp/stream20091026-21120-1qdbnul-0 is not recognized by the 'identify' command.

I tried adding:

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

to production.rb but it didn't make a difference.

In the log files I get the following errors:

Parameters: {"commit"=>"Upload", "action"=>"update", "_method"=>"put", "authenticity_token"=>"419410afc22737cd2f6b6096a95327db76a48ba9", "controller"=>"users", "user"=>{"avatar"=>#}} [paperclip] Saving attachments. [paperclip] An error was received while processing:

/tmp/stream20091026-20752-1g568yk-0 is not recognized by the 'identify' command.

like image 576
Chris Avatar asked Oct 14 '22 13:10

Chris


1 Answers

Identify is a command-line utility inside the ImageMagick package.

From its homepage:

The identify program describes the format and characteristics of one or more image files. It also reports if an image is incomplete or corrupt. The information returned includes the image number, the file name, the width and height of the image, whether the image is colormapped or not, the number of colors in the image, the number of bytes in the image, the format of the image (JPEG, PNM, etc.), and finally the number of seconds it took to read and process the image. Many more attributes are available with the verbose option.

First, copy the image on the server and run the identify command on it. You should receive something like:

identify ~/capture.jpg 
capture.jpg JPEG 1216x244 1216x244+0+0 8-bit DirectClass 97.7kb

If you receive an error, try upgrading the ImageMagick package on your server. You may find an updated binary release here: http://www.imagemagick.org/script/binary-releases.php

like image 109
Vlad Zloteanu Avatar answered Oct 20 '22 16:10

Vlad Zloteanu