0

我正在尝试让回形针 gem 在我的生产服务器(ubuntu 12.0.4、apache2、phusion 乘客和 rvm)上上传图像,并且对于每个附件,我都会收到三个这样的验证错误:

“识别”命令无法识别图像之一 /tmp/villa-0520121006-4333-hdo9wv.jpeg。

ImageMagick 已正确安装,libmagickwand-dev 软件包、Rmagick 和回形针也是如此。我已经将正确的 command_path 设置为 identify 和 convert 在我的 production.rb 配置文件中的位置。

如果有帮助,这是我的模型:

class Property < ActiveRecord::Base
    attr_accessible :img_one, :img_two, :img_three, :img_four, :img_five, :img_six, :price, :title, :description, :location, :beds, :property_type, :agreement_type, :featured  
    has_attached_file :img_one, :styles => { :medium => "420x280>", :mobile => "300x220", :thumb => "100x80>" }
    has_attached_file :img_two, :styles => { :medium => "420x280>", :mobile => "300x220", :thumb => "100x80>" }
    has_attached_file :img_three, :styles => { :medium => "420x280>", :mobile => "300x220", :thumb => "100x80>" }
    has_attached_file :img_four, :styles => { :medium => "420x280>", :mobile => "300x220", :thumb => "100x80>" }
    has_attached_file :img_five, :styles => { :medium => "420x280>", :mobile => "300x220", :thumb => "100x80>" }
    has_attached_file :img_six, :styles => { :medium => "420x280>", :mobile => "300x220", :thumb => "100x80>" }


    validates_presence_of :title, :description, :location, :beds, :property_type, :agreement_type, :price
    validates :price, :numericality => { :greater_than => 0 }
    validates :beds, :numericality => { :only_integer => true, :greater_than => 0 }
end

我真的为这个摸不着头脑,任何帮助或建议将不胜感激,谢谢

4

1 回答 1

2

这显然是由可卡因宝石 0.4.0 破坏回形针引起的(我使用的是回形针 3.2.0)。为了解决这个问题,我通过执行以下操作恢复到该 gem 的旧版本:

gem 卸载可卡因

将此添加到 gemfile

宝石“可卡因”,“0.3.2”

然后捆绑安装

捆绑安装

“识别”命令无法识别图像文件。(heroku) https://github.com/thoughtbot/paperclip/issues/1038

于 2012-10-07T01:39:18.637 回答