Make WordPress Core

Opened 12 months ago

Last modified 7 weeks ago

#50866 new defect (bug)

Media Uploader Blows Up File Sizes

Reported by: hvar Owned by:
Milestone: 5.9 Priority: normal
Severity: major Version: 5.4.2
Component: Media Keywords: has-patch has-unit-tests dev-feedback needs-testing has-testing-info
Focuses: administration, performance Cc:


Dear Developers,

this is a flaw in the media uploader that is very simple to reproduce:

create a 512x512 PNG image with best compression,

make sure that your wordpress is set to create small, medium, and large versions of that image,

set one of those versions to be also 512x512px, so when you upload a 512x512px image the media manager will create a copy of that image with the same size.

upload the image.

wordpress's uploader will not use the original 512x512px PNG image when this size is requested by a page, but instead it will use its own 512x512px image that it has created, and

compare sizes - the media uploader's PNG image file is at least 3x-4x times bigger, and wordpress will use that bigger image file instead of the smaller original of the same dimensions, and better compression.

Please, could you fix that?

Thank you

Attachments (2)

50866.1.patch (3.8 KB) - added by Mista-Flo 11 months ago.
Compression ticket.PNG (148.7 KB) - added by Boniu91 3 months ago.

Download all attachments as: .zip

Change History (13)

#1 @SergeyBiryukov
12 months ago

Thanks for the report!

Just linking to a ticket that might be related: #47713.

11 months ago

#2 @Mista-Flo
11 months ago

  • Keywords has-patch has-unit-tests dev-feedback needs-testing added; needs-patch removed

Hi there, I have uploaded a patch. It changes the behaviour of image_get_intermediate_size function to return the originale file info instead of the sub size if they share the exact same width and height.

I am not sure this need changes in other image functions. Please run some tests.

This ticket was mentioned in Slack in #core-media by florian-tiar. View the logs.

11 months ago

This ticket was mentioned in Slack in #core-media by florian-tiar. View the logs.

5 months ago

#5 @antpb
5 months ago

  • Milestone changed from Awaiting Review to 5.8

Mentioned in the recent Media Component meeting, this looks like a good ticket for 5.8. Adding to the milestone for visibility.

This ticket was mentioned in Slack in #core-media by florian-tiar. View the logs.

5 months ago

#7 @Boniu91
3 months ago

  • Keywords has-testing-steps added

#8 @Boniu91
3 months ago

  • Keywords has-testing-info added; has-testing-steps removed

This ticket was mentioned in Slack in #core-test by boniu91. View the logs.

3 months ago

#10 @Boniu91
3 months ago

I wasn't able to reproduce it. When adding media to the Gutenberg page, it's using the compressed version, not the generated one:

While on the server there was a specific copy available:

-rw-rw-r-- 1 ubuntu ubuntu 8.9K May  7 13:52 Webp.net-compress-image-2.jpg
-rw-rw-r-- 1 ubuntu ubuntu 4.3K May  7 13:52 Webp.net-compress-image-2-300x122.jpg
-rw-rw-r-- 1 ubuntu ubuntu  23K May  7 13:52 Webp.net-compress-image-2-1024x416.jpg
-rw-rw-r-- 1 ubuntu ubuntu 3.1K May  7 13:52 Webp.net-compress-image-2-150x150.jpg
-rw-rw-r-- 1 ubuntu ubuntu  14K May  7 13:52 Webp.net-compress-image-2-768x312.jpg
**-rw-rw-r-- 1 ubuntu ubuntu  13K May  7 13:52 Webp.net-compress-image-2-1536x624.jpg**

#11 @hellofromTonya
7 weeks ago

  • Milestone changed from 5.8 to 5.9

Today is 5.8 Beta 1. As @Boniu91 was unable to reproduce, it needs more time. Punting to 5.9 to continue progress towards resolution.

Note: See TracTickets for help on using tickets.