I\'ve installed ImageMagick on my Windows 7 64bit and I have the Paperclip Gem. My User model looks like this:
class User < ActiveRecord::Base
# Pape
Updated the following in development.rb and it started working
Paperclip.options[:command_path] = 'C:/Progra~1/ImageM~1.8-q'
This was on a Windows 2008 32 Bit Server
Open a command prompt and type echo %path%
your imagemagick path should appear there.
Also try changing the :command_path
to C:/Progra~1/ImageM~1
This is due to a bug in the Paperclip gem in lib/paperclip/command_line.rb
file.
def full_path(binary)
[self.class.path, binary].compact.join("/")
end
The full_path
function generates command file name with a backslash.
"C:\Program Files\ImageMagick-6.7.0-Q16"/identify
This command fails on Windows as the cmd
shell throws an error when the command file is a long file name with a back slash.
There are two ways to fix the issue.
Paperclip.options[:command_path] = 'C:/PROGRA~1/IMAGEM~1.0-Q'
Note: You can get the short file name as follows:
dir /x "C:\Program Files*"
dir /x "C:\Program Files\ImageMagick-6.7.0-Q16*"
config\initializers\paperclip.rb
.I tested this on 2.3.11.
class Paperclip::CommandLine
def full_path(binary)
[self.class.path, binary].compact.join(File::ALT_SEPARATOR||File::SEPARATOR)
end
end
Now, the identify
command is generated with the correct path seperator.
"C:\Program Files\ImageMagick-6.7.0-Q16"\identify
I prefer the second approach as command_path
is easier to configure.