2010-11-27 63 views
0

我剛剛下載了RJCrop from github,其特色是與JCrop一起使用Paperclip。我試着在我的Linux VPS上運行它,但工作得很好,但是當我在開發Windows Vista x64機器上運行同一項目時,出現此異常。回形針不能在Windows上使用ImageMagick

[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

回答

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

+0

你在哪裏重新寫這個? – bzupnick 2012-12-09 23:00:59