Hi,

after long investigation, I now have found the solution to get running the paperclipped extension on my Windows developer machine. For those of You, who are in the same situation (developing under Windows, deploying to *ix) this may be helpful. I had to fix all 3 errors to get it working.

All errors have the same impact: Paperclipped can't find ImageMagick (even if it is installed in Your PATH) and brings up error messages in log while uploading images like:

[paperclip] identify '-format' '%wx%h' 'C:/DOCUME~1/horibo/LOCALS~1/Temp/stream,3296,0.jpg[0]' 2>NUL [paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError: C:/DOCUME~1/horibo/LOCALS~1/Temp/stream,3296,0.jpg is not recognized by the 'identify' command.>

1. Install ImageMagick in a path without spaces
For some reason, paperclip won't find it, if the path to ImageMagick contains spaces (e.g. "C:\Program Files\ImageMagick\"). Don't forget to update Your PATH.

2. Give paperclip the path to ImageMagick
Even if in Your PATH, paperclip won't find ImageMagick. I put the following code in my /config/environments/development.rb:
Paperclip.options[:command_path] = "C:/Programs/ImageMagick-6.4.6-Q16/"

3. Avoid calling ImageMagick with single quotes
This is a long known issue with the paperclip plugin, which still isn't fixed in the master tree. The bug fix still works on *ix systems.

Apply the following patch to /vendor/extensions/paperclipped/vendor/plugins/paperclip/lib/paperclip.rb at line 133:

- option.split("'").map{|m| "'#{m}'" }.join("\\'")
+ option.split("'").map{|m| "\"#{m}\""}.join("\\'")

Enjoy!

Horst

Reply via email to