[wp-trac] [WordPress Trac] #48489: Big image size threshold should take into account registered image sizes.

WordPress Trac noreply at wordpress.org
Thu Nov 16 11:42:00 UTC 2023


#48489: Big image size threshold should take into account registered image sizes.
-------------------------------------------------+-------------------------
 Reporter:  johnbillion                          |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Media                                |     Version:  5.3
 Severity:  normal                               |  Resolution:
 Keywords:  good-first-bug has-patch needs-      |     Focuses:
  unit-tests                                     |
-------------------------------------------------+-------------------------

Comment (by f26d):

 The `9999` height hack for the `post-thumbnail` size does complicate
 thingsā€¦ I think it makes sense to loop over just the widths of the image
 sizes to potentially bump up `$threshold`.

 There doesn't seem to be a perfect solution to this, but in general
 (*waves hand*), it seems more common to resize images based on a width
 constraint than based on a height constraint. This makes me think that
 plenty of custom image sizes are likely to use identical width and height
 (or something like `9999` for the height, so that the height argument is
 essentially disregarded).

 I've updated @psrpinto's diff with this suggested approach, as well as
 with some unit tests.

 This is my first contribution to core, so please let me know if I'm
 missing something!

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


More information about the wp-trac mailing list