lib/image_resizer/format.rb
# Ensures the operations are valid. Won't work if the original image width
# and height values are unknown though.
#
Ensures the operations are valid. Won't work if the original image width
and height values are unknown though.
Ensures the operations are valid . Won ' t work if the original image width and height values are unknown though .
def valid?
      if crop = find_operation(:crop)
        return false if crop[:width].zero? || crop[:height].zero?
      end
      return true unless original_image_width && original_image_height
      if crop
        return false if crop[:width]  + crop[:x_offset] > original_image_width
        return false if crop[:height] + crop[:y_offset] > original_image_height
      end
      true
    end
def valid? if crop = find_operation ( :crop ) return false if crop [ :width ] . zero? || crop [ :height ] . zero? end return true unless original_image_width && original_image_height if crop return false if crop [ :width ] + crop [ :x_offset ] > original_image_width return false if crop [ :height ] + crop [ :y_offset ] > original_image_height end true end
Ensures the operations are valid.
Ensures the operations are valid .