Upload: Exclude PNG images from scaling after uploading. Fixes a case where resizing a very large PNG may create a scaled image that has smaller dimensions but larger file size than the original.

Fixes #48736.
Built from https://develop.svn.wordpress.org/trunk@46809


git-svn-id: http://core.svn.wordpress.org/trunk@46609 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2019-12-01 18:26:05 +00:00
parent 221287f626
commit 135e608b46
2 changed files with 74 additions and 70 deletions

View File

@ -244,6 +244,9 @@ function wp_create_image_subsizes( $file, $attachment_id ) {
$image_meta['image_meta'] = $exif_meta;
}
// Do not scale (large) PNG images. May result in sub-sizes that have greater file size than the original. See #48736.
if ( $imagesize['mime'] !== 'image/png' ) {
/**
* Filters the "BIG image" threshold value.
*
@ -334,6 +337,7 @@ function wp_create_image_subsizes( $file, $attachment_id ) {
}
}
}
}
// Initial save of the new metadata.
// At this point the file was uploaded and moved to the uploads directory

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.4-alpha-46808';
$wp_version = '5.4-alpha-46809';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.