From 303236107eeea84008257864f4aa0c2864a34349 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 18 Sep 2006 05:10:48 +0000 Subject: - Patch #59263 by stefan et al: bugfix, support PNGs with alpha layer. --- includes/image.inc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'includes') diff --git a/includes/image.inc b/includes/image.inc index 37f377c1a..93622f509 100644 --- a/includes/image.inc +++ b/includes/image.inc @@ -223,6 +223,13 @@ function image_gd_resize($source, $destination, $width, $height) { } $res = imageCreateTrueColor($width, $height); + if ($info['extension'] == 'png') { + $transparency = imagecolorallocatealpha($res, 0, 0, 0, 127); + imagealphablending($res, FALSE); + imagefilledrectangle($res, 0, 0, $width, $height, $transparency); + imagealphablending($res, TRUE); + imagesavealpha($res, TRUE); + } imageCopyResampled($res, $im, 0, 0, 0, 0, $width, $height, $info['width'], $info['height']); $result = image_gd_close($res, $destination, $info['extension']); -- cgit v1.2.3