diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ee59fa180f..671c5a3fa88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ - Fixed a UI bug where autosuggest menus weren’t getting filtered when first opened for inputs with existing values. ([#11896](https://github.com/craftcms/cms/issues/11896)) - Fixed a bug where Entry Type condition rules weren’t working for conditions that were applied to a single element. ([#11914](https://github.com/craftcms/cms/issues/11914)) - Fixed a bug where form action keyboard shortcuts weren’t available when a custom select menu was focused. ([#11919](https://github.com/craftcms/cms/issues/11919)) +- 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)) ### Security - Fixed XSS vulnerabilities. diff --git a/src/image/Raster.php b/src/image/Raster.php index 97c00a1cbcb..3b73a66c5c7 100644 --- a/src/image/Raster.php +++ b/src/image/Raster.php @@ -214,6 +214,7 @@ public function crop(int $x1, int $x2, int $y1, int $y2): self $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); @@ -701,6 +702,7 @@ private function _getSaveOptions(?int $quality, ?string $extension = null): arra return ['jpeg_quality' => $quality, 'flatten' => true]; case 'gif': + case 'webp': return ['animated' => $this->_isAnimatedGif]; case 'png':