I'm getting an error when I run the Spree sample data. It occurs when Spree tries to load in the product data, specifically the product images. Here's the error I'm getting:
* Execute db:load_file
loading ruby <GEM DIR>/sample/lib/tasks/../../db/sample/spree/products.rb
-- Processing image: ror_tote.jpeg
rake aborted!
/var/folders/91/63kgbtds2czgp0skw3f8190r0000gn/T/ror_tote.jpeg20121007-21549-2rktq1 is not recognized by the 'identify' command.
<GEM DIR>/paperclip-2.7.1/lib/paperclip/geometry.rb:31:in `from_file'
<GEM DIR>/spree/core/app/models/spree/image.rb:35:in `find_dimensions'
I've made sure ImageMagick is installed correctly, as previously I was having problems with it. Here's the output I'm getting when running the identify command directly.
$ identify
Version: ImageMagick 6.7.7-6 2012-10-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenCL
... other usage info omitted ...
I also used pry with the pry-debugger and put a breakpoint in geometry.rb inside of Paperclip. Here's what that section of geometry.rb looks like:
# Uses ImageMagick to determing the dimensions of a file, passed in as either a
# File or path.
# NOTE: (race cond) Do not reassign the 'file' variable inside this method as it is likely to be
# a Tempfile object, which would be eligible for file deletion when no longer referenced.
def self.from_file file
file_path = file.respond_to?(:path) ? file.path : file
raise(Errors::NotIdentifiedByImageMagickError.new("Cannot find the geometry of a file with a blank name")) if file_path.blank?
geometry = begin
silence_stream(STDERR) do
binding.pry
Paperclip.run("identify", "-format %wx%h :file", :file => "#{file_path}[0]")
end
rescue Cocaine::ExitStatusError
""
rescue Cocaine::CommandNotFoundError => e
raise Errors::CommandNotFoundError.new("Could not run the `identify` command. Please install ImageMagick.")
end
parse(geometry) ||
raise(Errors::NotIdentifiedByImageMagickError.new("#{file_path} is not recognized by the 'identify' command."))
end
At the point of my binding.pry statement, the file_path variable is set to the following:
file_path => "/var/folders/91/63kgbtds2czgp0skw3f8190r0000gn/T/ror_tote.jpeg20121007-22732-1ctl1g1"
I've also double checked that this exists, by opening my finder in this directory, and opened it with preview app; and also that the program can run identify by running %x{identify} in pry, and I receive the same version Version: ImageMagick 6.7.7-6 2012-10-06 Q16 as before.
Removing the additional digits (is this a timestamp?) after the file extension and running the Paperclip.run command manually in Pry gives me a different error:
Cocaine::ExitStatusError: Command 'identify -format %wx%h :file' returned 1. Expected 0
I've also tried manually updating the Paperclip gem in Spree to 3.0.2 and still get the same error. So, I'm not really sure what else to try. Is there still something incorrect with my ImageMagick setup?