Sha256: b926bcebd98e4c114c6511c6074cc8b05bda4f8567c08ae9c60ee41348670f41
Contents?: true
Size: 868 Bytes
Versions: 4
Compression:
Stored size: 868 Bytes
Contents
module CropImageRiffpad module ClassMethods def awesome_crop(attachment_name) # todo - define instance methods attr_accessor :crop_x, :crop_y, :crop_w, :crop_h after_update "preprocess_#{attachment_name}", :if => :cropping? attr_accessible :crop_x, :crop_y, :crop_w, :crop_h self.class_eval do def cropping? !crop_x.blank? && !crop_y.blank? && !crop_w.blank? && !crop_h.blank? end define_method "#{attachment_name}_geometry" do |style=:original| @geometry ||= {} @geometry[style] ||= Paperclip::Geometry.from_file(self.send(attachment_name).path(style)) end private define_method "preprocess_#{attachment_name}" do self.send(attachment_name).reprocess! end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems