回形针错误:'identify'命令无法识别文件名 - ImageMagick

时间:2012-01-21 01:15:42

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

image/png
[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError: /var/folders/0f/hgplttnd7dg6q9m62qtbnpn00000gn/T/stream20120120-99159-ji1e70.png is not recognized by the 'identify' command.>

这是Uploads

的模型
class Upload < ActiveRecord::Base
    acts_as_voteable
    has_attached_file :image, :styles => {  :thumb => "64x64" },
                :storage => :s3,
            :s3_credentials => "#{::Rails.root.to_s}/config/s3.yml",
            :path => "/:style/:id/:filename"

    validates :stage_id, :presence => true
    validates :name, :presence => true
    validates_attachment_presence :image                    
  validates_attachment_size :image, :less_than => 10.megabytes
  validates_attachment_content_type :image, :content_type => ['image/jpeg', 'image/png', 'image/gif', 'image/jpg', 'image/JPG']

我听说如果我删除:styles它会起作用,但这会破坏使用Paperclip的目的。我需要能够在每次上传图片时创建大小的缩略图。

感谢。

1 个答案:

答案 0 :(得分:2)

确切地发生在我身上,请检查Problems installing RMagick with Paperclip in Rails 3

需要安装imagemagick(使用自制软件建议),然后包含gem'rmagick'。