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:
Dan Ungureanu
2021-06-21 14:13:24 +03:00
committed by GitHub
parent e64f9c87fb
commit c69b58e22e

View File

@ -59,13 +59,11 @@ class UploadCreator
clean_svg!
elsif !Rails.env.test? || @opts[:force_optimize]
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?
crop! if should_crop?
optimize! if should_optimize?
downsize! if should_downsize?
return @upload if is_still_too_big?
end
# conversion may have switched the type