[wp-trac] [WordPress Trac] #38281: Generating thumbnails matching original image dimensions

WordPress Trac noreply at wordpress.org
Tue Oct 11 01:19:37 UTC 2016


#38281: Generating thumbnails matching original image dimensions
--------------------------+-----------------------------
 Reporter:  galbaras      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  4.6.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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 ) {
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38281>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list