Skip to content
Snippets Groups Projects
Commit 30323610 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #59263 by stefan et al: bugfix, support PNGs with alpha layer.

parent bf41b22c
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment