diff --git a/CImage.php b/CImage.php index 6aa0acc..1a1d790 100644 --- a/CImage.php +++ b/CImage.php @@ -2329,7 +2329,7 @@ private function createImageKeepTransparency($width, $height) ? imagecolortransparent($this->image) : -1; - if ($index != -1) { + if ($index >= 0 && $index < imagecolorstotal($this->image)) { imagealphablending($img, true); $transparent = imagecolorsforindex($this->image, $index);