Skip to content

Commit

Permalink
Fixed yield of RMagic crop method.
Browse files Browse the repository at this point in the history
RMagic should `crop!` with a bang!
MiniMagic `crop` method should `.apply(combine_options)`.
Fixed copy/paste error in MiniMagic `crop` method description.
Removed redundant blank line in MiniMagic & RMagic `crop` method descriptions.
  • Loading branch information
clickworkorange committed Feb 5, 2024
1 parent e83118b commit b355e37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/carrierwave/processing/mini_magick.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ def resize_and_pad(width, height, background=:transparent, gravity='Center', com
# by [width] and [height]. The original image bottom/right edge is preserved if the cropping box falls
# outside the image bounds.
#
#
# === Parameters
#
# [left (integer)] left edge of area to extract
Expand All @@ -229,13 +228,14 @@ def resize_and_pad(width, height, background=:transparent, gravity='Center', com
#
# === Yields
#
# [Magick::Image] additional manipulations to perform
# [MiniMagick::Image] additional manipulations to perform
#
def crop(left, top, width, height, combine_options: {}, &block)
width, height = resolve_dimensions(width, height)

minimagick!(block) do |builder|
builder.crop(left, top, width, height)
.apply(combine_options)
end
end

Expand Down
5 changes: 3 additions & 2 deletions lib/carrierwave/processing/rmagick.rb
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ def resize_to_geometry_string(geometry_string)
# by [width] and [height]. The original image bottom/right edge is preserved if the cropping box falls
# outside the image bounds.
#
#
# === Parameters
#
# [left (integer)] left edge of area to extract
Expand All @@ -286,7 +285,9 @@ def crop(left, top, width, height, combine_options: {})
height = dimension_from height

manipulate! do |img|
img.crop(left, top, width, height)
img.crop!(left, top, width, height)
img = yield(img) if block_given?
img
end
end

Expand Down

0 comments on commit b355e37

Please sign in to comment.