Topic: Paperclip Cropping issue -

Hi Team,

I followed this screencast from the great Ryan Bates...

The only difference that i'm doing is not uploading and doing the crop at the same time i am doing it separately.

Everything seems to work and when i process the method i created in the controller i don't get any errors back and it says flash[:notice] confirming it worked. So what am i doing wrong then? why are the :small and :medium style not cropping to what i have selected?

below is the output in the production log

Processing PrdImagesController#crop_update (for at 2011-03-21 20:05:53) [PUT]
  Parameters: {"commit"=>"Crop", "action"=>"crop_update", "_method"=>"put", "authenticity_token"=>"atmAFv+qfH7dDQ26n1YRwJlLxQZVWt8q353nlG9Vl88=", "id"=>"2027934163", "controller"=>"prd_images", "prd_image"=>{"title"=>"", "crop_h"=>"238", "crop_w"=>"238", "crop_x"=>"242", "crop_y"=>"189"}}
[paperclip] Saving attachments.
Redirected to
Completed in 18ms (DB: 8) | 302 Found []

model prd_image.rd
NOTE: I have modified Paperclip so i can pull in session data into it for the styles and path thus why it might not look right to some people... but it all works as i have paperclip and image uploading working on several other models fine... i just need help with the cropping issue.

class PrdImage < ActiveRecord::Base
  belongs_to :product
  attr_accessor :crop_x, :crop_y, :crop_w, :crop_h
  after_update :reprocess_image, :if => :cropping?
  has_attached_file :image, :styles => { :small => {:processors => [:cropper]}, :medium => {:processors => [:cropper]}},
                    :url  => "/site_media/:pattern2/product-images/:id/:style/:basename.:extension",
                    :path => ":rails_root/public/site_media/:pattern2/product-images/:id/:style/:basename.:extension"
  validates_attachment_size :image, :less_than => 2.megabytes
  validates_attachment_content_type :image, :content_type => ['image/jpeg', 'image/png', 'image/gif']  
  acts_as_list  :scope => :product_id
  def cropping?
    !crop_x.blank? && !crop_y.blank? && !crop_w.blank? && !crop_h.blank?
  def image_geometry(style = :original)
    @geometry ||= {}
    @geometry[style] ||= Paperclip::Geometry.from_file(image.path(style))

  def pattern1
  def pattern2
  def reprocess_image

Any ideas would be much appreciated.