[wp-trac] [WordPress Trac] #32437: Uploaded images are still saved as a "resized" duplicate

WordPress Trac noreply at wordpress.org
Tue May 19 08:12:08 UTC 2015


#32437: Uploaded images are still saved as a "resized" duplicate
--------------------------+-----------------------------
 Reporter:  wpdennis      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  4.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 This is a follow-up to #31296.

 The provided patch in #31296 doesn't fix the issue introduced with #19793
 in all instances.

 For example: Let's say a theme has a content width of 600 and by default
 authors are uploading images in 600*300. But the admin could have set the
 media settings to 600*3000, since only the width is mandatory. The height
 can vary if the author feels it's necessary (e.g. infographics or
 headline-like images in 600*100).

 But since the current version duplicates the image in every case, except
 both dimensions are equal to the media settings, we would still get every
 image twice (except someone is uploading an image in 600*3000 in this
 example).

 I think it should check whether ''$orig_size'' is equal to the '''resized
 dimensions''', instead of ''$size_data'' in this snippet:

 {{{
 $image = $this->_resize( $size_data['width'], $size_data['height'],
 $size_data['crop'] );

 $duplicate = ( ( $orig_size['width'] == $size_data['width'] ) && (
 $orig_size['height'] == $size_data['height'] ) );
 }}}

 An if the resized image has the same dimensions, it shouldn't be saved
 again.

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


More information about the wp-trac mailing list