Skip to content

Commit 61c7aec

Browse files
authored
png image bg fix
PNG and GIF image BG fix if the watermark is applied.
1 parent 2ff0b3a commit 61c7aec

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

az.multi.upload.class.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ public function compressImage($sourceURL, $destinationURL, $minImgWidth, $wmImag
6464
// width to calculate positioning of the watermark.
6565
imagecopy($image, $watermark, imagesx($image) - $sx - $positionRight, imagesy($image) - $sy - $positionBottom, 0, 0, imagesx($watermark), imagesy($watermark));
6666

67+
imagealphablending($image, false);
68+
imagesavealpha($image, true);
69+
6770
imagecopyresampled($imgResource, $image, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
6871
} elseif ($infoImg['mime'] == 'image/gif'){
6972
$image = imagecreatefromgif($sourceURL);
@@ -75,6 +78,9 @@ public function compressImage($sourceURL, $destinationURL, $minImgWidth, $wmImag
7578
// width to calculate positioning of the watermark.
7679
imagecopy($image, $watermark, imagesx($image) - $sx - $positionRight, imagesy($image) - $sy - $positionBottom, 0, 0, imagesx($watermark), imagesy($watermark));
7780

81+
imagealphablending($image, false);
82+
imagesavealpha($image, true);
83+
7884
imagecopyresampled($imgResource, $image, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
7985
}
8086

0 commit comments

Comments
 (0)