Sha256: b5f9cee851b3aeab2848890beeb18010d5f686c72b70cc0bd37297232026cc02
Contents?: true
Size: 1.02 KB
Versions: 13
Compression:
Stored size: 1.02 KB
Contents
module ActiveadminSelleoCms class Image < ActiveadminSelleoCms::Asset attr_accessor :image_width, :image_height, :resize_method has_attached_file :data, :url => "/system/cms/images/:id/:style_:basename.:extension", :path => ":rails_root/public/system/cms/images/:id/:style_:basename.:extension", :styles => Proc.new{ |attachment| attachment.instance.image_sizes }, :default_style => :normal, :processors => [:cropper] validates_attachment_size :data, :less_than => 1.megabytes validates_attachment_presence :data attr_protected :id after_update :reprocess_image, :if => :cropping? def cropping? !crop_x.blank? && !crop_y.blank? && !crop_w.blank? && !crop_h.blank? end def image_sizes { :normal => "#{image_width || 640}x#{image_height || 480}#{resize_method || ">"}" } end private def reprocess_image data.assign(data) data.save end end end
Version data entries
13 entries across 13 versions & 1 rubygems