mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: use correct command line attribute for gifsicle while scale down the gif.
This commit is contained in:
@@ -236,11 +236,12 @@ class OptimizedImage < ActiveRecord::Base
|
|||||||
|
|
||||||
def self.resize_instructions_animated(from, to, dimensions, opts = {})
|
def self.resize_instructions_animated(from, to, dimensions, opts = {})
|
||||||
ensure_safe_paths!(from, to)
|
ensure_safe_paths!(from, to)
|
||||||
|
resize_method = opts[:scale_image] ? "scale" : "resize-fit"
|
||||||
|
|
||||||
%W{
|
%W{
|
||||||
gifsicle
|
gifsicle
|
||||||
--colors=#{opts[:colors] || 256}
|
--colors=#{opts[:colors] || 256}
|
||||||
--resize-fit #{dimensions}
|
--#{resize_method} #{dimensions}
|
||||||
--optimize=3
|
--optimize=3
|
||||||
--output #{to}
|
--output #{to}
|
||||||
#{from}
|
#{from}
|
||||||
|
|||||||
@@ -245,14 +245,16 @@ class UploadCreator
|
|||||||
|
|
||||||
from = @file.path
|
from = @file.path
|
||||||
to = down_tempfile.path
|
to = down_tempfile.path
|
||||||
|
scale = (from =~ /\.GIF$/i) ? "0.5" : "50%"
|
||||||
|
|
||||||
OptimizedImage.ensure_safe_paths!(from, to)
|
OptimizedImage.ensure_safe_paths!(from, to)
|
||||||
|
|
||||||
OptimizedImage.downsize(
|
OptimizedImage.downsize(
|
||||||
from,
|
from,
|
||||||
to,
|
to,
|
||||||
"50%",
|
scale,
|
||||||
allow_animation: allow_animation,
|
allow_animation: allow_animation,
|
||||||
|
scale_image: true,
|
||||||
raise_on_error: true
|
raise_on_error: true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user