mirror of
https://github.com/mosbth/cimage.git
synced 2025-01-29 09:47:37 +01:00
Resize gif keeping transparency #81.
This commit is contained in:
parent
aa009510be
commit
641d67d7a0
@ -1945,6 +1945,8 @@ class CImage
|
||||
$this->log("imageistruecolor() : " . (imageistruecolor($this->image) ? 'true' : 'false'));
|
||||
$this->log("imagecolorstotal() : " . imagecolorstotal($this->image));
|
||||
$this->log("Number of colors in image = " . $this->colorsTotal($this->image));
|
||||
$index = imagecolortransparent($this->image);
|
||||
$this->log("Detected transparent color = " . ($index > 0 ? implode(", ", imagecolorsforindex($this->image, $index)) : "NONE") . " at index = $index");
|
||||
}
|
||||
|
||||
return $this;
|
||||
@ -2629,7 +2631,17 @@ class CImage
|
||||
imagealphablending($img, false);
|
||||
imagesavealpha($img, true);
|
||||
|
||||
if ($this->bgColorDefault) {
|
||||
$index = imagecolortransparent($this->image);
|
||||
if ($index != -1) {
|
||||
|
||||
imagealphablending($img, true);
|
||||
$transparent = imagecolorsforindex($this->image, $index);
|
||||
$color = imagecolorallocatealpha($img, $transparent['red'], $transparent['green'], $transparent['blue'], $transparent['alpha']);
|
||||
imagefill($img, 0, 0, $color);
|
||||
$index = imagecolortransparent($img, $color);
|
||||
$this->Log("Detected transparent color = " . implode(", ", $transparent) . " at index = $index");
|
||||
|
||||
} elseif ($this->bgColorDefault) {
|
||||
|
||||
$color = $this->getBackgroundColor($img);
|
||||
imagefill($img, 0, 0, $color);
|
||||
@ -2762,6 +2774,8 @@ class CImage
|
||||
$this->log("imageistruecolor() : " . (imageistruecolor($this->image) ? 'true' : 'false'));
|
||||
$this->log("imagecolorstotal() : " . imagecolorstotal($this->image));
|
||||
$this->log("Number of colors in image = " . $this->ColorsTotal($this->image));
|
||||
$index = imagecolortransparent($this->image);
|
||||
$this->log("Detected transparent color = " . ($index > 0 ? implode(", ", imagecolorsforindex($this->image, $index)) : "NONE") . " at index = $index");
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
@ -1945,6 +1945,8 @@ class CImage
|
||||
$this->log("imageistruecolor() : " . (imageistruecolor($this->image) ? 'true' : 'false'));
|
||||
$this->log("imagecolorstotal() : " . imagecolorstotal($this->image));
|
||||
$this->log("Number of colors in image = " . $this->colorsTotal($this->image));
|
||||
$index = imagecolortransparent($this->image);
|
||||
$this->log("Detected transparent color = " . ($index > 0 ? implode(", ", imagecolorsforindex($this->image, $index)) : "NONE") . " at index = $index");
|
||||
}
|
||||
|
||||
return $this;
|
||||
@ -2629,7 +2631,17 @@ class CImage
|
||||
imagealphablending($img, false);
|
||||
imagesavealpha($img, true);
|
||||
|
||||
if ($this->bgColorDefault) {
|
||||
$index = imagecolortransparent($this->image);
|
||||
if ($index != -1) {
|
||||
|
||||
imagealphablending($img, true);
|
||||
$transparent = imagecolorsforindex($this->image, $index);
|
||||
$color = imagecolorallocatealpha($img, $transparent['red'], $transparent['green'], $transparent['blue'], $transparent['alpha']);
|
||||
imagefill($img, 0, 0, $color);
|
||||
$index = imagecolortransparent($img, $color);
|
||||
$this->Log("Detected transparent color = " . implode(", ", $transparent) . " at index = $index");
|
||||
|
||||
} elseif ($this->bgColorDefault) {
|
||||
|
||||
$color = $this->getBackgroundColor($img);
|
||||
imagefill($img, 0, 0, $color);
|
||||
@ -2762,6 +2774,8 @@ class CImage
|
||||
$this->log("imageistruecolor() : " . (imageistruecolor($this->image) ? 'true' : 'false'));
|
||||
$this->log("imagecolorstotal() : " . imagecolorstotal($this->image));
|
||||
$this->log("Number of colors in image = " . $this->ColorsTotal($this->image));
|
||||
$index = imagecolortransparent($this->image);
|
||||
$this->log("Detected transparent color = " . ($index > 0 ? implode(", ", imagecolorsforindex($this->image, $index)) : "NONE") . " at index = $index");
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
@ -1945,6 +1945,8 @@ class CImage
|
||||
$this->log("imageistruecolor() : " . (imageistruecolor($this->image) ? 'true' : 'false'));
|
||||
$this->log("imagecolorstotal() : " . imagecolorstotal($this->image));
|
||||
$this->log("Number of colors in image = " . $this->colorsTotal($this->image));
|
||||
$index = imagecolortransparent($this->image);
|
||||
$this->log("Detected transparent color = " . ($index > 0 ? implode(", ", imagecolorsforindex($this->image, $index)) : "NONE") . " at index = $index");
|
||||
}
|
||||
|
||||
return $this;
|
||||
@ -2629,7 +2631,17 @@ class CImage
|
||||
imagealphablending($img, false);
|
||||
imagesavealpha($img, true);
|
||||
|
||||
if ($this->bgColorDefault) {
|
||||
$index = imagecolortransparent($this->image);
|
||||
if ($index != -1) {
|
||||
|
||||
imagealphablending($img, true);
|
||||
$transparent = imagecolorsforindex($this->image, $index);
|
||||
$color = imagecolorallocatealpha($img, $transparent['red'], $transparent['green'], $transparent['blue'], $transparent['alpha']);
|
||||
imagefill($img, 0, 0, $color);
|
||||
$index = imagecolortransparent($img, $color);
|
||||
$this->Log("Detected transparent color = " . implode(", ", $transparent) . " at index = $index");
|
||||
|
||||
} elseif ($this->bgColorDefault) {
|
||||
|
||||
$color = $this->getBackgroundColor($img);
|
||||
imagefill($img, 0, 0, $color);
|
||||
@ -2762,6 +2774,8 @@ class CImage
|
||||
$this->log("imageistruecolor() : " . (imageistruecolor($this->image) ? 'true' : 'false'));
|
||||
$this->log("imagecolorstotal() : " . imagecolorstotal($this->image));
|
||||
$this->log("Number of colors in image = " . $this->ColorsTotal($this->image));
|
||||
$index = imagecolortransparent($this->image);
|
||||
$this->log("Detected transparent color = " . ($index > 0 ? implode(", ", imagecolorsforindex($this->image, $index)) : "NONE") . " at index = $index");
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
Loading…
x
Reference in New Issue
Block a user