我正在尝试使用回形针宝石在我的生产服务器(ubuntu 12.0.4,apache2,phusion passenger和rvm)上传图像,对于每个附件,我得到三个这样的验证错误:
“识别”命令无法识别/tmp/villa-0520121006-4333-hdo9wv.jpeg。
正确安装ImageMagick,libmagickwand-dev软件包,Rmagick和paperclip也是如此。 我已将正确的command_path设置为识别和转换位于我的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
我真的对这个问题感到头疼,任何帮助或建议都会非常感激 感谢
答案 0 :(得分:2)
这显然是由可卡因宝石0.4.0破纸夹(我使用的是回形针3.2.0)引起的。为了解决这个问题,我通过以下方式恢复了该gem的旧版本:
宝石卸载可卡因
将此添加到gemfile
宝石'可卡因','0.3.2'
然后捆绑安装
捆绑安装
Image file is not recognized by the 'identify' command. (heroku) https://github.com/thoughtbot/paperclip/issues/1038