Opened 6 months ago
Last modified 3 months ago
#61925 new defect (bug)
subsizes with same dimensions are generated multiple times unnecessarily
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Media | Keywords: | has-patch |
Focuses: | Cc: |
Description
https://github.com/WordPress/wordpress-develop/blob/6.6/src/wp-admin/includes/image.php#L461
_wp_make_subsizes
will generate the same file with same dimensions multiple times if multiple sizes with the same dimensions/crop are registered.
This unnecessarily slows down the uploads and often is a cause for timeouts too, if there are many sizes registered.
e.g. with WooCommerce where "woocommerce_gallery_thumbnail" might be equal to wp "thumbnail" size.
I checked trac, but couldn't find a related issue, in case there's one please close this one.
Change History (5)
#2
@
6 months ago
But for the new image I can only see one image in uploads with dimension 800X600.
Sorry, but obviously. How would you be able to see multiple files with the same name?
It generates the same 800x600 file multiple times.
Your replication is correct except that you incorrectly check the result. Set a breakpoint at the referenced line and you'll see that it recreates the image multiple times for 800x600
#4
@
3 months ago
As reported in https://core.trac.wordpress.org/ticket/62388 for "crop" it doesn't actually crop (see https://core.trac.wordpress.org/ticket/62389#ticket), so the cropped images that have identical dimensions as ones already generated can be skipped too.
This ticket was mentioned in PR #7802 on WordPress/wordpress-develop by @kkmuffme.
3 months ago
#5
- Keywords has-patch added
Trac ticket: https://core.trac.wordpress.org/ticket/61925
Hii @kkmuffme ,
I tried to replicate the issue but was not able to.
These are the steps I followed:
Can you please specify the steps to replicate this?
Thanks.