FIX: PNG-to-JPEG conversion should only be done to images with at least 1 megapixels

This commit is contained in:
Régis Hanol 2017-06-01 23:12:37 +02:00
parent 832d621b48
commit 062158a25e

View File

@ -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