# File lib/paperclip/geometry_transformation.rb, line 53
    def scaled_to_fit(other)
      if (other.width > 0 && other.height == 0)
        Geometry.new(other.width, self.height * other.width / self.width)
      elsif (other.width == 0 && other.height > 0)
        Geometry.new(self.width * other.height / self.height, other.height)
      else
        ratio = Geometry.new( other.width / self.width, other.height / self.height )
        if ratio.square?
          other.without_modifier
        elsif ratio.horizontal?
          Geometry.new(ratio.height * self.width, other.height)
        else
          Geometry.new(other.width, ratio.width * self.height)
        end
      end
    end