Method: CarrierWave::MiniMagick#resize_to_limit
- Defined in:
- lib/carrierwave/processing/mini_magick.rb
#resize_to_limit(width, height, combine_options: {}, &block) ⇒ Object
Resize the image to fit within the specified dimensions while retaining the original aspect ratio. Will only resize the image if it is larger than the specified dimensions. The resulting image may be shorter or narrower than specified in the smaller dimension but will not be larger than the specified values.
Parameters
- width (Integer)
-
the width to scale the image to
- height (Integer)
-
the height to scale the image to
- combine_options (Hash)
-
additional ImageMagick options to apply before resizing
Yields
- MiniMagick::Image
-
additional manipulations to perform
125 126 127 128 129 130 131 132 |
# File 'lib/carrierwave/processing/mini_magick.rb', line 125 def resize_to_limit(width, height, combine_options: {}, &block) width, height = resolve_dimensions(width, height) minimagick!(block) do |builder| builder.resize_to_limit(width, height) .apply() end end |