From: Marcel Werk Date: Sun, 18 Dec 2016 11:06:11 +0000 (+0100) Subject: Fixed resizing of animated gifs X-Git-Tag: 3.0.0_RC_2~37 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c2b0223eb91b10521b6063733eadc05a7e6ea024;p=GitHub%2FWoltLab%2FWCF.git Fixed resizing of animated gifs --- 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 51b5580290..78815582f0 100644 --- a/wcfsetup/install/files/lib/system/image/adapter/ImagickImageAdapter.class.php +++ b/wcfsetup/install/files/lib/system/image/adapter/ImagickImageAdapter.class.php @@ -165,9 +165,22 @@ class ImagickImageAdapter implements IImageAdapter { * @inheritDoc */ public function resize($originX, $originY, $originWidth, $originHeight, $targetWidth, $targetHeight) { - $this->clip($originX, $originY, $originWidth, $originHeight); - - $this->imagick->resizeImage($targetWidth, $targetHeight, \Imagick::FILTER_POINT, 0); + if ($this->imagick->getImageFormat() == 'GIF') { + $image = $this->imagick->coalesceImages(); + + foreach ($image as $frame) { + $frame->cropImage($originWidth, $originHeight, $originX, $originY); + $frame->thumbnailImage($targetWidth, $targetHeight); + $frame->setImagePage($targetWidth, $targetHeight, 0, 0); + } + + $this->imagick = $image->deconstructImages(); + } + else { + $this->clip($originX, $originY, $originWidth, $originHeight); + + $this->imagick->resizeImage($targetWidth, $targetHeight, \Imagick::FILTER_POINT, 0); + } } /**