mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 21:16:28 +08:00
FIX: Downsize image last when saving uploads (#13458)
The other processing operations, such as fixing orientation or cropping, can in rare cases increase the size of the uploaded image. Running the downsize step after all these operations should create the best image possible.
This commit is contained in:
parent
e64f9c87fb
commit
c69b58e22e
|
@ -59,13 +59,11 @@ class UploadCreator
|
||||||
clean_svg!
|
clean_svg!
|
||||||
elsif !Rails.env.test? || @opts[:force_optimize]
|
elsif !Rails.env.test? || @opts[:force_optimize]
|
||||||
convert_to_jpeg! if convert_png_to_jpeg? || should_alter_quality?
|
convert_to_jpeg! if convert_png_to_jpeg? || should_alter_quality?
|
||||||
downsize! if should_downsize?
|
|
||||||
|
|
||||||
return @upload if is_still_too_big?
|
|
||||||
|
|
||||||
fix_orientation! if should_fix_orientation?
|
fix_orientation! if should_fix_orientation?
|
||||||
crop! if should_crop?
|
crop! if should_crop?
|
||||||
optimize! if should_optimize?
|
optimize! if should_optimize?
|
||||||
|
downsize! if should_downsize?
|
||||||
|
return @upload if is_still_too_big?
|
||||||
end
|
end
|
||||||
|
|
||||||
# conversion may have switched the type
|
# conversion may have switched the type
|
||||||
|
|
Loading…
Reference in New Issue
Block a user