From 7d35ee1adebef12c003db0bfabd859dacd992d26 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Sun, 11 Jan 2015 21:43:31 +0100 Subject: [PATCH] Fixed issues in gif animation processing --- .../adapter/ImagickImageAdapter.class.php | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/system/image/adapter/ImagickImageAdapter.class.php b/wcfsetup/install/files/lib/system/image/adapter/ImagickImageAdapter.class.php index 4f0be1bfe2..1917df0dc1 100644 --- a/wcfsetup/install/files/lib/system/image/adapter/ImagickImageAdapter.class.php +++ b/wcfsetup/install/files/lib/system/image/adapter/ImagickImageAdapter.class.php @@ -197,7 +197,18 @@ class ImagickImageAdapter implements IImageAdapter { // draw text $draw->annotation($x, $y, $text); - $this->imagick->drawImage($draw); + + if ($this->imagick->getImageFormat() == 'GIF') { + $this->imagick = $this->imagick->coalesceImages(); + + do { + $this->imagick->drawImage($draw); + } + while ($this->imagick->nextImage()); + } + else { + $this->imagick->drawImage($draw); + } } /** @@ -353,8 +364,19 @@ class ImagickImageAdapter implements IImageAdapter { } $overlayImage->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $opacity, \Imagick::CHANNEL_OPACITY); - $this->imagick->compositeImage($overlayImage, \Imagick::COMPOSITE_OVER, $x, $y); - $this->imagick = $this->imagick->flattenImages(); + + if ($this->imagick->getImageFormat() == 'GIF') { + $this->imagick = $this->imagick->coalesceImages(); + + do { + $this->imagick->compositeImage($overlayImage, \Imagick::COMPOSITE_OVER, $x, $y); + } + while ($this->imagick->nextImage()); + } + else { + $this->imagick->compositeImage($overlayImage, \Imagick::COMPOSITE_OVER, $x, $y); + $this->imagick = $this->imagick->flattenImages(); + } } /** -- 2.20.1