Make WordPress Core

Opened 3 years ago

Closed 12 days ago

#42470 closed defect (bug) (worksforme)

add_image_size: incorrect relative scaling

Reported by: the_Alien_01 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.8.3
Component: Media Keywords: reporter-feedback close
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 (3)

#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/)

#2 @hellofromTonya
6 weeks ago

  • Keywords close added

Hello @the_Alien_01,

I walked through the steps and, like Jonathan, I too was unable to reproduce the issue.

Does this issue persist still today? If yes, can you provide us with some feedback (to help us further investigate):

For now, I'm marking this ticket as a close worksforme candidate. Why? There are no other reports of this specific problem. I suspect the issue is not due to WordPress core, but like a plugin/theme conflict or image regeneration. Please don't be alarmed. If the problem persists, we will continue investigating.

#3 @hellofromTonya
12 days ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

I'm closing this ticket. However, if the problem persists, please reopen and provide more information to help us further investigate.

Note: See TracTickets for help on using tickets.