# Example usage of Jcropper # == Schema Information # Table name: image_models # # id :integer(4) not null, primary key # image_file_name :string(255) # image_content_type :string(255) # image_file_size :integer(4) # image_updated_at :datetime # crop_x :integer(4) default(0) # crop_y :integer(4) default(0) # crop_h :integer(4) default(0) # crop_w :integer(4) default(0) # class ImageModel < ActiveRecord::Base has_attached_file :image, :styles => { :resized => '120x41>', :cropped => '100%x100%' }, :processors => [:jcropper], :convert_options => { :all => proc { |m| "-crop #{m.crop_w}x#{m.crop_h}+#{m.crop_x}+#{m.crop_y}" } } def crop_settings [crop_x, crop_y, (crop_x+crop_w), (crop_y+crop_h)] end end