mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 00:06:55 +02:00
Attempt fix for processwire/processwire-issues#1299 using @adrianbj suggestion
This commit is contained in:
@@ -862,12 +862,13 @@ class ImageSizerEngineGD extends ImageSizerEngine {
|
||||
} else if($this->imageType == IMAGETYPE_GIF) {
|
||||
// @mrx GIF transparency
|
||||
$transparentIndex = imagecolortransparent($image);
|
||||
// $transparentColor = $transparentIndex != -1 ? @imagecolorsforindex($image, $transparentIndex) : 0;
|
||||
$transparentColor = $transparentIndex != -1 ? imagecolorsforindex($image, ($transparentIndex < imagecolorstotal($image) ? $transparentIndex : $transparentIndex - 1)) : 0;
|
||||
if(!empty($transparentColor)) {
|
||||
$transparentNew = imagecolorallocate($im, $transparentColor['red'], $transparentColor['green'], $transparentColor['blue']);
|
||||
$transparentNewIndex = imagecolortransparent($im, $transparentNew);
|
||||
imagefill($im, 0, 0, $transparentNewIndex);
|
||||
if($transparentIndex >= 0 && $transparentIndex < imagecolorstotal($image)) {
|
||||
$transparentColor = imagecolorsforindex($image, $transparentIndex);
|
||||
if(!empty($transparentColor)) {
|
||||
$transparentNew = imagecolorallocate($im, $transparentColor['red'], $transparentColor['green'], $transparentColor['blue']);
|
||||
$transparentNewIndex = imagecolortransparent($im, $transparentNew);
|
||||
imagefill($im, 0, 0, $transparentNewIndex);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user