diff --git a/app/models/optimized_image.rb b/app/models/optimized_image.rb index d228ce059..97989d60b 100644 --- a/app/models/optimized_image.rb +++ b/app/models/optimized_image.rb @@ -118,11 +118,11 @@ class OptimizedImage < ActiveRecord::Base def self.resize_instructions_animated(from, to, dimensions, opts={}) %W{ gifsicle - #{from} --colors=256 --resize-fit #{dimensions} --optimize=3 --output #{to} + #{from} } end @@ -142,7 +142,14 @@ class OptimizedImage < ActiveRecord::Base end def self.crop_instructions_animated(from, to, dimensions, opts={}) - resize_instructions_animated(from, to, dimensions, opts) + %W{ + gifsicle + --crop 0,0+#{dimensions} + --colors=256 + --optimize=3 + --output #{to} + #{from} + } end def self.downsize_instructions(from, to, dimensions, opts={}) diff --git a/lib/image_sizer.rb b/lib/image_sizer.rb index 3cf9f126f..ee368ce3d 100644 --- a/lib/image_sizer.rb +++ b/lib/image_sizer.rb @@ -28,7 +28,8 @@ module ImageSizer return [w.floor, h.floor] if w <= max_width && h <= max_height ratio = max_width / w - [max_width.floor, [max_height, (h * ratio)].min.floor] + + [[max_width, w].min.floor, [max_height, (h * ratio)].min.floor] end end