lib/image_resizer/format.rb
# Tries to fix the crop values. Requires original image width and height.
# Returns the object so to allow method chaining.
#
Tries to fix the crop values. Requires original image width and height.
Returns the object so to allow method chaining.
Tries to fix the crop values . Requires original image width and height . Returns the object so to allow method chaining .
def fix_crop!
      return @owner unless original_image_width && original_image_height
      return @owner unless crop = find_operation(:crop)
      safe_w, safe_x = safe_bounds(crop[:width],  crop[:x_offset], original_image_width)
      safe_h, safe_y = safe_bounds(crop[:height], crop[:y_offset], original_image_height)
      crop.merge!(
        width: safe_w, height: safe_h, x_offset: safe_x, y_offset: safe_y
      )
      @owner
    end
def fix_crop! return @owner unless original_image_width && original_image_height return @owner unless crop = find_operation ( :crop ) safe_w , safe_x = safe_bounds ( crop [ :width ] , crop [ :x_offset ] , original_image_width ) safe_h , safe_y = safe_bounds ( crop [ :height ] , crop [ :y_offset ] , original_image_height ) crop . merge! ( width : safe_w , height : safe_h , x_offset : safe_x , y_offset : safe_y ) @owner end
Tries to fix the crop values.
Tries to fix the crop values .