lib/carrierwave/processing/rmagick.rb in carrierwave-0.2.4 vs lib/carrierwave/processing/rmagick.rb in carrierwave-0.3.0
- old
+ new
@@ -61,9 +61,40 @@
#
# http://rubyforge.org/forum/forum.php?thread_id=1374&forum_id=1618
#
module RMagick
+ def self.included(base)
+ super
+ base.extend(ClassMethods)
+ end
+
+ module ClassMethods
+ def convert(format)
+ process :resize_to_limit => format
+ end
+
+ def resize_to_limit(width, height)
+ process :resize_to_limit => [width, height]
+ end
+
+ def resize_to_fit(width, height)
+ process :resize_to_fit => [width, height]
+ end
+
+ def resize_to_fill(width, height)
+ process :resize_to_fill => [width, height]
+ end
+
+ def resize_and_pad(width, height)
+ process :resize_to_fit => [width, height]
+ end
+
+ def resize_and_pad(width, height, background=:transparent, gravity=::Magick::CenterGravity)
+ process :resize_and_pad => [width, height, background, gravity]
+ end
+ end
+
##
# Changes the image encoding format to the given format
#
# See even http://www.imagemagick.org/RMagick/doc/magick.html#formats
#