当我尝试上传照片时红宝石 on Rails http://en.wikipedia.org/wiki/Ruby_on_Rails using 回形针 http://github.com/thoughtbot/paperclip在我的本地机器上它运行得很好。
当我尝试在 Linux 上使用 Paperclip 在 Ruby on Rails 中上传照片时(CentOS http://en.wikipedia.org/wiki/CentOS5.2)带有 Apache 的服务器和Phusion 乘客 http://en.wikipedia.org/wiki/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"
到生产.rb 但它没有什么区别。
在日志文件中我收到以下错误:
参数:{"提交"=>"上传",
“操作”=>“更新”,“_method”=>“放置”,
“authenticity_token”=>“419410afc22737cd2f6b6096a95327db76a48ba9”,
“控制器”=>“用户”,
“用户”=>{“头像”=>#}}
[回形针] 保存附件。
[回形针] 收到错误
处理时:
/tmp/stream20091026-20752-1g568yk-0 是
不被“识别”识别
命令。
识别是一个命令行实用程序图像魔术师 https://en.wikipedia.org/wiki/ImageMagick包裹。
从其主页:
识别程序描述了
一种或多种的格式和特征
更多图像文件。它还报告如果
图像不完整或损坏。这
返回的信息包括
图片编号、文件名、宽度
和图像的高度,是否
图像是否有颜色映射,
图像中的颜色数量,
图像中的字节数,
图像的格式(JPEG、PNM 等),
最后是秒数
读取并处理图像。
还有更多属性可用
与详细选项。
首先,将映像复制到服务器上并对其运行识别命令。您应该收到类似以下内容:
identify ~/capture.jpg
capture.jpg JPEG 1216x244 1216x244+0+0 8-bit DirectClass 97.7kb
如果收到错误,请尝试升级服务器上的 ImageMagick 包。您可以在这里找到更新的二进制版本:http://www.imagemagick.org/script/binary-releases.php https://www.imagemagick.org/script/download.php
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)