mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
FIX: cropping GIF wasn't working
This commit is contained in:
parent
56d2626187
commit
11172b7c2d
2 changed files with 11 additions and 3 deletions
|
@ -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={})
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue