Update MemoryDrawing.php

This commit is contained in:
oleibman
2024-07-01 06:21:59 -07:00
committed by GitHub
parent a299be3a75
commit ae8f2d7bd5
@@ -101,10 +101,8 @@ class MemoryDrawing extends BaseDrawing
// If the image has transparency...
$transparent = imagecolortransparent($this->imageResource);
if ($transparent >= 0) {
// Starting with Php8.0, next function throws rather than return false
$rgb = imagecolorsforindex($this->imageResource, $transparent);
if (empty($rgb)) {
throw new Exception('Could not get image colors');
}
imagesavealpha($clone, true);
$color = imagecolorallocatealpha($clone, $rgb['red'], $rgb['green'], $rgb['blue'], $rgb['alpha']);