2009-10-26 8 views
5

Cuando intento cargar una foto en Ruby on Rails usando Paperclip en mi máquina local, funciona perfectamente.Paperclip/Passenger NotIdentifiedByImageMagickError:

Cuando intento cargar una foto en Ruby on Rails utilizando clip en nuestro Linux (CentOS 5.2) del servidor con Apache y Phusion Passenger, me sale:

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. 

He intentado añadir:

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

a production.rb pero no hizo la diferencia.

En los archivos de registro que obtienen los siguientes errores:

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.

Respuesta

4

de identificación es una utilidad de línea de comandos dentro del paquete ImageMagick.

Desde su página de inicio:

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.

En primer lugar, copie la imagen en el servidor y ejecutar el comando identificar en él. Debería recibir algo como:

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

Si recibe un mensaje de error, intente actualizar el paquete ImageMagick en su servidor. Usted puede encontrar una versión actualizada binaria aquí: http://www.imagemagick.org/script/binary-releases.php

+0

Después de una gran cantidad de perder el tiempo logré averiguar que las bibliotecas para .jpeg .png no se instalaron en nuestro servidor de producción de Linux, pero están instalados en mi imac. Así que tuve que descargar esas bibliotecas e instalarlas y luego reinstalar imagemagick (no ayudado por el hecho de que imagemagick.org ha estado inactivo toda la tarde :() – Chris

0

en mi caso con el mismo error, volver a instalar ImageMagic ayudó (Ubuntu 12.10)