2010-11-27 27 views
0

Je viens de télécharger le RJCrop from github avec l'utilisation de Paperclip avec JCrop. J'ai essayé de l'exécuter sur mon VPS Linux, ce qui fonctionnait très bien, mais quand je cours le même projet sur mon ordinateur de développement Windows Vista x64, je reçois cette exception.Paperclip ne fonctionne pas avec ImageMagick sur Windows

[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.> 

est dans mon Identifier PATH

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 

Et je également ajouté la configuration

Paperclip.options[:command_path] = File.join("c:", "ImageMagick") 

à environments/development.rb, mais il n'a pas aidé. Je cours Ruby 1.9.2p0.

Répondre

2

J'ai trouvé le problème.

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 

La méthode unix? est définie comme

def self.unix? 
    File.exist?("/dev/null") 
end 

qui cependant avec Cygwin installé renvoie true, même si couru dans cmd régulière (au moins pour moi). Donc je l'ai juste réécrit pour retourner faux et ça marche bien. J'ai également soumis ce numéro à paperclip on github

+0

où réécrivez-vous cela? – bzupnick