From cee93bd6a8d17fb4c888b0b617dab90684e9787c Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Mon, 5 Aug 2024 17:22:33 +0200 Subject: [PATCH] Fix bug in Cloner::cloneEmpty() If an image was cloned with cloneEmpty() and a fully transparent color for exampe "rgba(255, 255, 255, 0)" the turned out as white background. This patch sets the background color as fully transparent if it has an alpha channel value of 0 i.e. 100% transparent (clear). --- src/Drivers/Gd/Cloner.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Drivers/Gd/Cloner.php b/src/Drivers/Gd/Cloner.php index 8edc2023..d29d9add 100644 --- a/src/Drivers/Gd/Cloner.php +++ b/src/Drivers/Gd/Cloner.php @@ -67,6 +67,10 @@ public static function cloneEmpty( imagealphablending($clone, true); imagesavealpha($clone, true); + if ($background->isClear()) { + imagecolortransparent($clone, $processor->colorToNative($background)); + } + return $clone; }