From 2fe8d9ca00ee0abfa85ea5ebfdf31ddc8a06a816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Thu, 1 Jun 2017 23:12:37 +0200 Subject: [PATCH] FIX: PNG-to-JPEG conversion should only be done to images with at least 1 megapixels --- lib/upload_creator.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/upload_creator.rb b/lib/upload_creator.rb index 1a9b577420..a00b13f08f 100644 --- a/lib/upload_creator.rb +++ b/lib/upload_creator.rb @@ -122,9 +122,11 @@ class UploadCreator end end + MIN_PIXELS_TO_CONVERT_TO_JPEG ||= 1280 * 720 + def should_convert_to_jpeg? TYPES_CONVERTED_TO_JPEG.include?(@image_info.type) && - @image_info.size.min > 720 && + pixels > MIN_PIXELS_TO_CONVERT_TO_JPEG && SiteSetting.png_to_jpg_quality < 100 end