A few system details:
- Mac OS X Lion 10.7.2, Rails 3, Paperclip gem.
- ImageMagick 6.7.3-0, binaries installed using MacPorts in
/opt/local/bin
. - Using WEBrick in development environment.
I'm trying to upload photos that should get resized down into thumbnails. When I do so, the original uploaded file is saved and can be accessed via HTTP correctly. When I try to accessed the thumbnail version, I get this error:
Routing Error
No route matches "[file_URL]"
Before that, when uploading a valid PNG file, I see this error in my WEBrick log:
[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError: /var/folders/n4/62q22gb52rjd0h13cx_j8vv40000gq/T/stream20111020-24984-17560xt-0.png is not recognized by the 'identify' command.>
Doing which identify
outputs:
/opt/local/bin/identify
Calling identify
with the path of the uploaded file correctly identifies the file as a PNG file.
I confirmed rails server
starts the development environment. I added the following in config/environments/development.rb
:
Paperclip.options[:command_path] = "/opt/local/bin"
My Photo model has the following:
class Photo < ActiveRecord::Base
has_attached_file :file, :default_style => :view, :styles => {
:view => { :geometry => '520x390>', :format => 'jpg' },
:preview => { :geometry => '160x120>', :format => 'jpg' } }
validates_attachment_content_type :file,
:content_type => [ 'image/jpeg', 'image/pjpeg', 'image/png' ]
end
My Photos controller:
class PhotosController < ApplicationController
# ...
def create
@photo = Photo.create params[:photo]
end
end
Like I said, I can access the original images in the URL path system/files/:id/original
, but the resized versions I want aren't accessible and are not found in the filesystem. WEBrick's log suggest Paperclip can't even have ImageMagick identify the images before resizing them.
Any ideas? Thanks in advance!
NotIdentifiedByImageMagickError
). This question could be a duplicate: stackoverflow.com/questions/1623948/… – Jonathan Julian