[wp-trac] [WordPress Trac] #48209: Original file name changes on images upload and extra unregistered image sizes generated

WordPress Trac noreply at wordpress.org
Fri Oct 4 08:56:36 UTC 2019


#48209: Original file name changes on images upload and extra unregistered image
sizes generated
--------------------------+-----------------------------
 Reporter:  Iulia Cazan   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hello,

 I installed and tested the functionality provided with version 5.3-beta2
 and there is an issue with images uploads. Basically, when uploading an
 image, the filename that is recorded in the attachment metadata for the
 original file is using a suffix that indicates the original image width,
 and the file is created as well.

 For example, I uploaded the image called `image.jpeg` (with 5472×3648px)
 and the result looks like this:
 I end up with the following images in the folder:

 image-1024x683.jpeg - matches the `large` size - OK
 image-1200x800.jpeg - matches the `post-thumbnail` size - OK
 image-150x150.jpeg - matches the `thumbnail` size - OK
 image-1536x1024.jpeg - 1536x1536 - as far as I know, this should not be
 generated, there is no image size registered programmatically for this
 image-1980x1320.jpeg - matches the `twentytwenty-fullscreen` - OK
 image-2048x1365.jpeg - 2048x2048 - as far as I know, this should not be
 generated, there is no image size registered programmatically for this
 image-2560.jpeg - this is mapped as the original file, but this should be
 image.jpeg
 image-300x200.jpeg - matches the `medium` size - OK
 image.jpeg - this is the original file but is mapped separately

 And in the database the metadata contains these:

 `a:6:{s:5:"width";i:2560;s:6:"height";i:1707;s:4:"file";s:23:"2019/10/image-2560.jpeg";s:5:"sizes";a:8:{s:6:"medium";a:4:{s:4:"file";s:18
 :"image-300x200.jpeg";s:5:"width";i:300;s:6:"height";i:200;s:9:"mime-
 type";s:10:"image/jpeg";}s:5:"large";a:4:{s:4:"file";s:19:"image-
 1024x683.jpeg";s:5:"width";i:1024;s:6:"height";i:683;s:9:"mime-
 type";s:10:"image/jpeg";}s:9:"thumbnail";a:4:{s:4:"file";s:18:"image-
 150x150.jpeg";s:5:"width";i:150;s:6:"height";i:150;s:9:"mime-
 type";s:10:"image/jpeg";}s:12:"medium_large";a:4:{s:4:"file";s:18:"image-
 768x512.jpeg";s:5:"width";i:768;s:6:"height";i:512;s:9:"mime-
 type";s:10:"image/jpeg";}s:9:"1536x1536";a:4:{s:4:"file";s:20:"image-
 1536x1024.jpeg";s:5:"width";i:1536;s:6:"height";i:1024;s:9:"mime-
 type";s:10:"image/jpeg";}s:9:"2048x2048";a:4:{s:4:"file";s:20:"image-
 2048x1365.jpeg";s:5:"width";i:2048;s:6:"height";i:1365;s:9:"mime-
 type";s:10:"image/jpeg";}s:14:"post-thumbnail";a:4:{s:4:"file";s:19
 :"image-1200x800.jpeg";s:5:"width";i:1200;s:6:"height";i:800;s:9:"mime-
 type";s:10:"image/jpeg";}s:23:"twentytwenty-
 fullscreen";a:4:{s:4:"file";s:20:"image-
 1980x1320.jpeg";s:5:"width";i:1980;s:6:"height";i:1320;s:9:"mime-
 type";s:10:"image/jpeg";}}s:10:"image_meta";a:12:{s:8:"aperture";s:1:"0";s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";s:1:"0";s:9:"copyright";s:0:"";s:12:"focal_length";s:1:"0";s:3:"iso";s:1:"0";s:13:"shutter_speed";s:1:"0";s:5:"title";s:0:"";s:11:"orientation";s:1:"0";s:8:"keywords";a:0:{}}s:14:"original_image";s:10:"image.jpeg";}`

 My original test image.jpeg has 5472×3648 and the image that is now linked
 as the "original" image-2560.jpeg has been scaled and is not the original
 image. Basically, there is no real information about the actual file that
 was uploaded (the width and height are not mapped in the database at all).
 I confirm that my tests are done on a clean WordPress instance, with no
 custom settings and with the Twenty Twenty theme activated.

 If this is not a bug, but the intended new functionality, then this is
 quite a change and needs some documentation.

 As far as I understand, we will end up with a lot of hidden images (that
 will only pile up without ever being used), since most of the
 functionalities related to media are handling media attributes bases on
 the image sizes registered programmatically and readable/known image sizes
 names. Also, it's going to decrease the performance on upload, since there
 are extra image sizes that will be generated/handled per each file.

 Regards,
 Iulia

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


More information about the wp-trac mailing list