diff --git a/CHANGELOG.md b/CHANGELOG.md index 80e83390aea..775425d084a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - Fixed a bug where the Assets index page wasn’t handling failed uploads properly. ([#11866](https://github.com/craftcms/cms/issues/11866)) - Fixed a UI bug where renaming a newly-created volume subfolder didn’t appear to have any effect. - Fixed a bug where empty URL fields would be marked as changed, even when no change was made to them. ([#11908](https://github.com/craftcms/cms/issues/11908)) +- Fixed a bug where transforming an animated GIF into a WebP file would only include the first frame. ([#11889](https://github.com/craftcms/cms/issues/11889)) ## 3.7.53.1 - 2022-08-26 diff --git a/src/image/Raster.php b/src/image/Raster.php index e3b2c7fea54..e6b77810d05 100644 --- a/src/image/Raster.php +++ b/src/image/Raster.php @@ -209,6 +209,7 @@ public function crop(int $x1, int $x2, int $y1, int $y2) $gif = $this->_instance->create($newSize); $gif->layers()->remove(0); + $this->_image->layers()->coalesce(); foreach ($this->_image->layers() as $layer) { $croppedLayer = $layer->crop($startingPoint, $newSize); $gif->layers()->add($croppedLayer); @@ -703,6 +704,7 @@ private function _getSaveOptions(int $quality = null, string $extension = null): return ['jpeg_quality' => $quality, 'flatten' => true]; case 'gif': + case 'webp': return ['animated' => $this->_isAnimatedGif]; case 'png':