lib/image_resizer/format.rb
def safe_bounds(value, offset, max)
      end_offset = [(value + offset), max].min
      beg_offset = [offset, 0].max
      [(end_offset - beg_offset), beg_offset]
    end
# Returns the safe crop size and offset as a two-item array. If value+offset
# exceeds the image size then shrink the value and keep the offset.
#
Returns the safe crop size and offset as a two-item array. If value+offset
exceeds the image size then shrink the value and keep the offset.
Returns the safe crop size and offset as a two - item array . If value + offset exceeds the image size then shrink the value and keep the offset .
def safe_bounds(value, offset, max)
      end_offset = [(value + offset), max].min
      beg_offset = [offset, 0].max
      [(end_offset - beg_offset), beg_offset]
    end
def safe_bounds ( value , offset , max ) end_offset = [ ( value + offset ) , max ] . min beg_offset = [ offset , 0 ] . max [ ( end_offset - beg_offset ) , beg_offset ] end
Returns the safe crop size and offset as a two-item array.
Returns the safe crop size and offset as a two - item array .
value
offset
max