Skip to content

Commit

Permalink
Merge pull request #11920 from craftcms/bugfix/gif-webp
Browse files Browse the repository at this point in the history
Allow animated webp
  • Loading branch information
brandonkelly authored Sep 13, 2022
2 parents 836dd5f + 8ca004a commit 67e61e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/image/Raster.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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':
Expand Down

0 comments on commit 67e61e0

Please sign in to comment.