2014-09-29 121 views
1

NotIdentifiedByImageMagickError有以下型号:回形针::错误::在轨道4,5

class Picture < ActiveRecord::Base 
    belongs_to :business 

    has_attached_file :image, styles: { medium: "640x260>" } 
    validates_attachment :image, content_type: { :content_type => /\Aimage\/.*\Z/ } 
end 

而且我已经安装了 'ImageMagick的' 使用BREW(我使用的是Mac OS)。但是,当我试图执行以下代码

@picture = business.pictures.build(picture_params) 
@picture.save 

def picture_params 
    params.require(:picture).permit(:image) 
end 

我得到了以下错误:An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>

我试图更新PNG文件:

= form_for [:admin, business, @picture] do |f| 
    .row 
     = f.file_field :image 
     = f.submit 'Add' 

我怎样才能解决我的问题?

回答

0

验证使用identify ImageMagick的,你应该得到的东西是这样的: -

[email protected]:~/workspace/latest$ identify 
Version: ImageMagick 6.6.9-7 2014-03-06 Q16 http://www.imagemagick.org 
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC 
Features: OpenMP .... 

,这增加development.rb(知道哪里ImageMagick的安装你的路径)

Paperclip.options[:command_path] = "/usr/bin/identify" 
2

我同样的问题。我通过重新安装imagemagick解决了这个问题。

brew uninstall imagemagick jpeg libtiff 
brew install imagemagick 

链接的FreeType之前安装ImageMagick的,如果它不挂

brew link freetype 
+0

对于Windows用户有什么建议? – 2015-05-26 14:57:02