mirror of
https://github.com/discourse/discourse.git
synced 2025-06-24 03:01:33 +08:00
FIX: PNG-to-JPEG conversion should only be done to images with at least 1 megapixels
This commit is contained in:
@ -122,9 +122,11 @@ class UploadCreator
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
MIN_PIXELS_TO_CONVERT_TO_JPEG ||= 1280 * 720
|
||||||
|
|
||||||
def should_convert_to_jpeg?
|
def should_convert_to_jpeg?
|
||||||
TYPES_CONVERTED_TO_JPEG.include?(@image_info.type) &&
|
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
|
SiteSetting.png_to_jpg_quality < 100
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user