Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#38281 closed defect (bug) (duplicate)

Generating thumbnails matching original image dimensions

Reported by: galbaras's profile galbaras Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6.1
Component: Media Keywords:
Focuses: Cc:

Description

When the thumbnail size matches the uploaded image dimensions precisely, the thumbnail is created.

In image_resize_dimensions(), line 551 is:

if ( $new_w >= $orig_w && $new_h >= $orig_h && $dest_w != $orig_w && $dest_h != $orig_h ) {

This means that when $dest_w == $orig_w or $dest_h == $orig_h, a new file is created, when it shouldn't be, although the new file's dimensions match that of the original file.

The first 2 conditions ($new_w >= $orig_w && $new_h >= $orig_h) should be enough prevent the creation of an equal or larger file.

So the new code should be:

if ( $new_w >= $orig_w && $new_h >= $orig_h ) {

Change History (2)

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


7 years ago

#2 @desrosj
7 years ago

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

Duplicate of #32437.

Note: See TracTickets for help on using tickets.