本文介绍了回形针::错误:: NotIdentifiedByImageMagickError:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用回形针上传图片错误:

use paperclip upload image error:

命令::标识-format%wx%h'/tmp/103120121106-20384-i7dnzy.png[0]'[回形针]处理时收到错误:#< Paperclip :: Errors :: NotIdentifiedByImageMagickError:/tmp/103120121106-20384-i7dnzy.png无法被'identify'命令识别.>

Command :: identify -format %wx%h '/tmp/103120121106-20384-i7dnzy.png[0]' [paperclip] An error was received while processing:# < Paperclip::Errors::NotIdentifiedByImageMagickError: /tmp/103120121106-20384-i7dnzy.png is not recognized by the 'identify' command.>

我发现了身份

joinall@nxbbs-server:/nxbbs$ type identify  
identify is hashed (/usr/local/bin/identify) 
joinall@nxbbs-server:/nxbbs$ convert logo: 2.jpg 
joinall@nxbbs-server:/nxbbs$ identify  2.jpg
2.jpg GIF 640x480 640x480+0+0 8-bit sRGB 256c 31.7KB 0.000u 0:00.000

在config/environments/development.rb

In config/environments/development.rb

 Paperclip.options[:command_path] = "/user/local/bin"

在app/models/user.rb

In app/models/user.rb

attr_accessible :avatar
has_attached_file :avatar, :styles=> {:s120 => "120x120>",:s48 => "48x48>",:s16 => "16x16>"}

请帮助我,我找不到问题

please help me ,I can not find the problem

推荐答案

我有一个类似的问题,我发现我使用的是Paperclip 2.5,而回形针内部使用的是可卡因宝石.可卡因0.4.2不能向后兼容,所以我将可卡因降级到0.3.2,它们都神奇地起作用.在您的Gemfile中,只需编写

I had a similar problem and i figured out that I was using Paperclip 2.5 and paperclip internally uses cocaine gem. Cocaine 0.4.2 is not backward compatible so I downgraded cocaine to 0.3.2 and it all worked magically. In you Gemfile, just write

gem 'cocaine', '0.3.2'

并运行

bundle update

这篇关于回形针::错误:: NotIdentifiedByImageMagickError:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 00:37