From b4b59e27e537606bccf624cf7fdc3e6d0d92a4f9 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Wed, 22 Jul 2009 03:02:44 +0000 Subject: [PATCH] Generate same as original color depth thumbnails for PNG images, props madhyde, fixes #9887 git-svn-id: https://develop.svn.wordpress.org/trunk@11737 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/media.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wp-includes/media.php b/wp-includes/media.php index 7f34963842..f57e8de4ab 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -351,6 +351,10 @@ function image_resize( $file, $max_w, $max_h, $crop=false, $suffix=null, $dest_p } imagecopyresampled( $newimage, $image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); + + // convert from full colors to index colors, like original PNG. + if ( IMAGETYPE_PNG == $orig_type && !imageistruecolor( $image ) ) + imagetruecolortopalette( $newimage, false, imagecolorstotal( $image ) ); // we don't need the original in memory anymore imagedestroy( $image );