我刚刚下载了使用Paperclip和JCrop的RJCrop from github。我尝试在我的Linux VPS上运行它,它运行得很好,但是当我在我的开发Windows Vista x64机器上运行相同的项目时,我得到了这个例外。
[paperclip] identify -format %wx%h
'C:/Users/darth/AppData/Local/Temp/stream,3420,0.png[0]'
[paperclip] An error was received while processing:
#<Paperclip::NotIdentifiedByImageMagickError:
C:/Users/darth/AppData/Local/Temp/stream,3420,0.png
is not recognized by the 'identify' command.>
[paperclip] identify -format %wx%h
'C:/Users/darth/AppData/Local/Temp/stream,3420,0.png[0]'
[paperclip] An error was received while processing:
#<Paperclip::NotIdentifiedByImageMagickError:
C:/Users/darth/AppData/Local/Temp/stream,3420,0.png
is not recognized by the 'identify' command.>
识别是在我的路径中
C:\>identify -versrubion
Version: ImageMagick 6.6.5-9 2010-11-15 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP
我还添加了
Paperclip.options[:command_path] = File.join("c:", "ImageMagick")
配置到environments/development.rb
,但没有帮助。我正在运行Ruby 1.9.2p0
。
答案 0 :(得分:2)
我发现了这个问题。
def shell_quote(string)
return "" if string.nil? or string.blank?
if self.class.unix?
string.split("'").map{|m| "'#{m}'" }.join("\\'")
else
%{"#{string}"}
end
end
unix?
方法定义为
def self.unix?
File.exist?("/dev/null")
end
然而安装Cygwin时返回true,即使在常规cmd中运行(至少对我而言)。所以我只是重写它以返回false并且它工作正常。我还将此问题提交给paperclip on github