FIX: don't butcher GIFs

Use 'gifsicle' instead of 'convert' to resize & optimize GIFs

FIX: don't even try to fix GIFs orientation
FIX: use 'allow_animated_thumbnails' site setting for user profile backgrounds & user cards
This commit is contained in:
Régis Hanol
2015-07-22 17:10:42 +02:00
parent ccdcca578d
commit d456460d33
2 changed files with 12 additions and 17 deletions

View File

@@ -65,8 +65,8 @@ class Upload < ActiveRecord::Base
w = svg["width"].to_i
h = svg["height"].to_i
else
# fix orientation first
fix_image_orientation(file.path)
# fix orientation first (but not for GIFs)
fix_image_orientation(file.path) unless filename =~ /\.GIF$/i
# retrieve image info
image_info = FastImage.new(file) rescue nil
w, h = *(image_info.try(:size) || [0, 0])
@@ -80,7 +80,7 @@ class Upload < ActiveRecord::Base
# crop images depending on their type
if CROPPED_IMAGE_TYPES.include?(options[:image_type])
allow_animation = false
allow_animation = SiteSetting.allow_animated_thumbnails
max_pixel_ratio = Discourse::PIXEL_RATIOS.max
case options[:image_type]