Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#42470 new defect (bug)

add_image_size: incorrect relative scaling

Reported by: the_Alien_01 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8.3
Component: Media Keywords: reporter-feedback
Focuses: Cc:


Wordpress seems to mess up relative image scaling with add_image_size.

The code of my child theme reads:

add_image_size( 'name', 9999, 525, false );

With the '9999' based on https://developer.wordpress.org/reference/functions/add_image_size/#other-notes

Upon entering a landscape image w2500 x h1250 the image is resized to w525 x h263, taking the longest side of the image as height, instead of the actual height (in this case 1250px). Portrait images are (of course) resized according to their height (which is their longest side).

Change History (1)

#1 @desrosj
3 years ago

  • Keywords reporter-feedback added

Hi @the_Alien_01, welcome to Trac! And thanks for the ticket.

I just tried to reproduce the issue that you described and as unable to do so. In my testing, I uploaded a 2000 × 846 image and it was resized correctly to 1241x525, and a 1966 × 1228 image was correctly resized to 841x525.

Are you still seeing this behavior? If so, can you please try to reproduce it in a fresh install of WordPress?

Also, is this a relatively new image size? If so, can you confirm that you have regenerated image thumbnails either using the WP-CLI (https://developer.wordpress.org/cli/commands/media/regenerate/) or Regenerate Thumbnails plugin (https://wordpress.org/plugins/regenerate-thumbnails/)

Note: See TracTickets for help on using tickets.