回形针/乘客 NotIdentifiedByImageMagickError: [英] Paperclip / Passenger NotIdentifiedByImageMagickError:

查看:52
本文介绍了回形针/乘客 NotIdentifiedByImageMagickError:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用 Ruby on Rails 上传照片时http://github.com/thoughtbot/paperclip" rel="nofollow noreferrer">Paperclip 在我的本地机器上运行良好.

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

当我尝试在 Linux 上使用 Paperclip 在 Ruby on Rails 中上传照片时 (CentOS 5.2) 带有 Apache 和 Phusion Passenger 的服务器,我得到:

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.

我尝试添加:

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

到 production.rb 但它没有任何区别.

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

在日志文件中,我收到以下错误:

In the log files I get the following errors:

参数:{提交"=>上传",动作"=>更新",_方法"=>放置",authenticity_token"=>419410afc22737cd2f6b6096a95327db76a48ba9",控制器"=>用户",用户"=>{头像"=>#}}[回形针] 保存附件.[回形针] 收到错误处理时:

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 是不被识别"识别命令.

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

推荐答案

Identify 是 ImageMagick 包.

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

来自其主页:

识别程序描述了一个或一个的格式和特征更多图像文件.它还报告如果图像不完整或损坏.这返回的信息包括图像编号、文件名、宽度和图像的高度,是否图像是否经过颜色映射,图像中的颜色数量,图像中的字节数,图像格式(JPEG、PNM 等),最后是秒数需要读取和处理图像.更多属性可用带有详细选项.

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

如果您收到错误消息,请尝试升级您服务器上的 ImageMagick 软件包.您可以在此处找到更新的二进制版本:http://www.imagemagick.org/script/binary-releases.php

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

这篇关于回形针/乘客 NotIdentifiedByImageMagickError:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆