[wp-trac] [WordPress Trac] #48485: Custom image size not generated if identical to original size

WordPress Trac noreply at wordpress.org
Tue May 30 09:24:18 UTC 2023


#48485: Custom image size not generated if identical to original size
-------------------------------------------------+-------------------------
 Reporter:  brampeerlings                        |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  6.3
Component:  Media                                |     Version:  5.2.4
 Severity:  minor                                |  Resolution:
 Keywords:  needs-screenshots has-testing-info   |     Focuses:
  close                                          |  administration
-------------------------------------------------+-------------------------
Changes (by azaozz):

 * keywords:  needs-patch needs-screenshots has-testing-info => needs-
     screenshots has-testing-info close


Comment:

 > When defining a custom image size using add_image_size and uploading an
 image that has exactly the same dimensions of that image size, the new
 image size is not added.

 Yes, this is the expected behavior. The same thing happens when the
 uploaded image matches exactly one of the default sizes, for example
 "large". There's no point in having two image files with exactly the same
 size.

 > An even prettier fix would be to detect the custom image size is
 identical to the original size and map the custom image size URL to the
 original file URL.

 Not sure about that. Having two "entries" for the same image file would be
 pretty confusing. Would also make it messier when generating the `srcset`
 for the image.

 Imho this should be closed as worksforme. Plugins that depend on having
 specifically named image file sizes can add or replace the names that
 appear in the "Insert Image" drop-down.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48485#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list