0
votes

I'm using paperclip with Rails 3.1. When I add the image, it shows me the original size but doesn't show me thumb or medium sizes:

Here is what I have in my view:

<%= image_tag @image.avatar.url(:thumb) %>
<%= image_tag @image.avatar.url(:medium) %>

image.rb

 has_attached_file :avatar, :whiny => false, :styles => { :medium => "300x300>", :thumb => "100x100>" }

UPDATE:

Here is the error I'm getting with :whiny => true

Command :: identify -format %wx%h '/var/folders/54/txjcl9l130j6dq73r37hf2c00000gn/T/stream20111213-9180-1plu1me.png[0]' [paperclip] An error was received while processing: #

Command :: identify -format %wx%h '/var/folders/54/txjcl9l130j6dq73r37hf2c00000gn/T/stream20111213-9180-1plu1me.png[0]' [paperclip] An error was received while processing: # Rendered images/new.html.erb within layouts/application (4.0ms)

1
Considering that you have :whiny => false, there could very likely be an exception occurring during the thumbnail creation process. Try setting :whiny => true and post any errors you encounter. My guess: image magic isn't installed, or Rails doesn't know where to find it because your path isn't set.Greg W

1 Answers

2
votes

First, make sure that Image Magick is installed.

To see if its installed properly, go to a terminal session and type which convert. You should see a path to the executable.

Once that is done, you may need to add the path to your environment.rb file. For example, my convert is located at /usr/local/bin/convert. Now I've seen two different ways of setting your path for paperclip, try one or the other and see what works.

# specifically set the paperclip path
Paperclip.options[:command_path] = '/usr/local/bin'

# set the path in general, might not be necessary
ENV['PATH'] = '/usr/local/bin:' + ENV['PATH']