From fb62a7c0c3ebbd4cc0da58b358ab7e3b59b3f52e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Thu, 24 Sep 2015 21:04:06 +0200 Subject: [PATCH] FIX: only downsize user card & profile backgrounds --- app/models/upload.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/upload.rb b/app/models/upload.rb index 928455e5fc5..32998238b63 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -95,15 +95,16 @@ class Upload < ActiveRecord::Base when "avatar" allow_animation = SiteSetting.allow_animated_avatars width = height = Discourse.avatar_sizes.max + OptimizedImage.resize(file.path, file.path, width, height, filename: filename, allow_animation: allow_animation) when "profile_background" max_width = 850 * max_pixel_ratio width, height = ImageSizer.resize(w, h, max_width: max_width, max_height: max_width) + OptimizedImage.downsize(file.path, file.path, "#{width}x#{height}", filename: filename, allow_animation: allow_animation) when "card_background" max_width = 590 * max_pixel_ratio width, height = ImageSizer.resize(w, h, max_width: max_width, max_height: max_width) + OptimizedImage.downsize(file.path, file.path, "#{width}x#{height}", filename: filename, allow_animation: allow_animation) end - - OptimizedImage.resize(file.path, file.path, width, height, filename: filename, allow_animation: allow_animation) end # optimize image