paperclip gem validation error - 'filename' is not recognized by the 'identify' command

北城余情 提交于 2019-12-31 05:17:08

问题


I'm trying to get the paperclip gem to upload images on my production server (ubuntu 12.0.4, apache2, phusion passenger and rvm) and for each attachment I get three lots of this validation error:

Img one /tmp/villa-0520121006-4333-hdo9wv.jpeg is not recognized by the 'identify' command.

ImageMagick is installed properly, as is the libmagickwand-dev package, Rmagick and paperclip. And I've set the correct command_path to where identify and convert are located in my production.rb config file.

here is my model if it helps:

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

I'm really scratching my head with this one and any help or advice would be much appreciated thanks


回答1:


This was apparently caused by the cocaine gem 0.4.0 breaking paperclip (I'm using paperclip 3.2.0). To fix the issue I reverted back to an older version of that gem by doing:

gem uninstall cocaine

adding this to gemfile

gem 'cocaine', '0.3.2'

and then bundle installing

bundle install

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



来源:https://stackoverflow.com/questions/12762515/paperclip-gem-validation-error-filename-is-not-recognized-by-the-identify

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!