mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +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
1 changed files with 2 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue