Generate same as original color depth thumbnails for PNG images, props madhyde, fixes #9887

git-svn-id: http://svn.automattic.com/wordpress/trunk@11737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-07-22 03:02:44 +00:00
parent 14047212f2
commit 2cc87216e8

View File

@ -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 );