WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 3 months ago

#48518 closed defect (bug) (fixed)

Inconsistent behavior when a registered image size is larger than the big image threshold

Reported by: azaozz Owned by: azaozz
Milestone: 5.3 Priority: normal
Severity: normal Version: 5.3
Component: Upload Keywords: has-patch fixed-major commit dev-feedback
Focuses: Cc:
PR Number:

Description

When a registered image sub-size is larger than the big image threshold, it is still used to create the sub-sizes in wp_create_image_subsizes() but not in wp_update_image_subsizes().

Happens because wp_get_missing_image_subsizes() only looks at the existing image meta and doesn't take into account the original image dimensions.

Attachments (1)

48518.diff (926 bytes) - added by azaozz 3 months ago.

Download all attachments as: .zip

Change History (10)

@azaozz
3 months ago

#1 @azaozz
3 months ago

  • Keywords has-patch 2nd-opinion added
  • Milestone changed from Awaiting Review to 5.3

Moving to 5.3 as it is an inconsistency with the new "big image" handling.

In 48518.diff: when an image was scaled because it is larger than the big image threshold, use the originally uploaded image's dimensions in wp_get_missing_image_subsizes(). This fixes an edge case/inconsistent behaviour when a registered image sub-size is also larger than the big image threshold.

This ticket was mentioned in Slack in #core-media by azaozz. View the logs.


3 months ago

This ticket was mentioned in Slack in #core-media by mike. View the logs.


3 months ago

#4 @desrosj
3 months ago

This looks to be working for me, @azaozz! I have a 3000x3000 soft crop image size and 4000x4000 hard crop image size registered and it works correctly!

#5 @azaozz
3 months ago

Thanks for testing!

Lets add it to trunk for some more/easier testing and merge tomorrow if all looks good.

#6 @azaozz
3 months ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 46677:

Upload: When an image was scaled because it is larger than the big image threshold, use the originally uploaded image's dimensions in wp_get_missing_image_subsizes(). Fixes an edge case/inconsistent behaviour when a registered image sub-size is also larger than the big image threshold.

Props desrosj, azaozz.
Fixes #48518 for trunk.

#7 @azaozz
3 months ago

  • Keywords fixed-major commit dev-feedback added; 2nd-opinion removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopen for 5.3.

#8 @mikeschroder
3 months ago

Thanks so much!

I’m +1 to merge this for 5.3.

#9 @azaozz
3 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 46680:

Upload: When an image was scaled because it is larger than the big image threshold, use the originally uploaded image's dimensions in wp_get_missing_image_subsizes(). Fixes an edge case/inconsistent behaviour when a registered image sub-size is also larger than the big image threshold.

Props desrosj, azaozz.
Merges [46677] to the 5.3 branch.
Fixes #48518.

Note: See TracTickets for help on using tickets.