首先,若是遇到这个问题,Paperclip::NotIdentifiedByImageMagickError,先检查下环境变量是否配置了ImagicMagick的路径。html
cmd下path 查看,首先加入ImageMagick path环境git
其次,cmd下运行下面两个命令:github
convert logo: logo.gif identify logo.gif
看是否运行成功
若是还没等到解决ruby
has_attached_file :photo, :whiny => false, #加入这个配置,看下是否能等到解决 :styles => { :medium => "300x300>", :thumb => "100x100>" }
能够参考https://github.com/thoughtbot/paperclip/blob/master/lib/paperclip.rb这个连接。less
若是问题仍是出现的话,在config/initializers目录下增长个文件paperclip.rbide
Paperclip.options[:command_path] = "E:\ImageMagick" Paperclip.options[:swallow_stderr] = false def run cmd, params = "", expected_outcodes = 0 command = %Q<#{%Q[#{path_for_command(cmd)} #{params}].gsub(/\s+/, " ")}> command = "#{command} 2>#{bit_bucket}" if Paperclip.options[:swallow_stderr] output = `#{command}` unless [expected_outcodes].flatten.include?($?.exitstatus) raise PaperclipCommandLineError, "Error while running #{cmd}" end output end
特别感谢:https://www.cnblogs.com/lmei/p/3321981.html 以及博主code