【问题标题】:paperclip gem validation error - 'filename' is not recognized by the 'identify' command回形针 gem 验证错误 - 'identify' 命令无法识别'filename'
【发布时间】:2012-10-06 18:19:32
【问题描述】:

我正在尝试让回形针 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

我真的对此一头雾水,任何帮助或建议将不胜感激 谢谢

【问题讨论】:

    标签: ruby-on-rails-3 imagemagick paperclip


    【解决方案1】:

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

    gem 卸载可卡因

    将其添加到 gemfile

    宝石'可卡因','0.3.2'

    然后捆绑安装

    捆绑安装

    Image file is not recognized by the 'identify' command. (heroku) https://github.com/thoughtbot/paperclip/issues/1038

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-25
      相关资源
      最近更新 更多