Commit 2b00ad0c by Jon Yurek

slight refactoring in geometry.rb to - only calculate transformation ratio if…

slight refactoring in geometry.rb to - only calculate transformation ratio if image needs to be cropped (Clemens Kofler)
parent 19546a01
...@@ -76,9 +76,9 @@ module Paperclip ...@@ -76,9 +76,9 @@ module Paperclip
# overhanging image would be cropped. Useful for square thumbnail images. The cropping # overhanging image would be cropped. Useful for square thumbnail images. The cropping
# is weighted at the center of the Geometry. # is weighted at the center of the Geometry.
def transformation_to dst, crop = false def transformation_to dst, crop = false
ratio = Geometry.new( dst.width / self.width, dst.height / self.height )
if crop if crop
ratio = Geometry.new( dst.width / self.width, dst.height / self.height )
scale_geometry, scale = scaling(dst, ratio) scale_geometry, scale = scaling(dst, ratio)
crop_geometry = cropping(dst, ratio, scale) crop_geometry = cropping(dst, ratio, scale)
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment