Skip to content

Commit

Permalink
Accept AVIF images #10871
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerKiKi committed Nov 12, 2024
1 parent cd39834 commit 5a54ddd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Model/Traits/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ protected function getBasePath(): string
protected function getAcceptedMimeTypes(): array
{
return [
'image/avif',
'image/bmp',
'image/x-ms-bmp',
'image/gif',
Expand Down Expand Up @@ -106,6 +107,7 @@ private function readFileInfo(): void

// Pretty much only SVG is better than WebP
$worseThanWebp = in_array($this->getMime(), [
'image/avif',
'image/bmp',
'image/x-ms-bmp',
'image/gif',
Expand Down
1 change: 1 addition & 0 deletions tests/Model/Traits/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public static function providerSetFile(): iterable
{
yield 'jpg is converted to webp' => ['image.jpg', 400, 400];
yield 'png is converted to webp' => ['image.png', 400, 300];
yield 'avif is converted to webp' => ['image.avif', 400, 299];
yield 'svg is untouched' => ['logo.svg', 445, 488, true];
yield 'webp is untouched' => ['image.webp', 400, 400];
yield 'huge jpg is resized to webp' => ['huge.jpg', 3500, 19];
Expand Down
Binary file added tests/data/images/image.avif
Binary file not shown.

0 comments on commit 5a54ddd

Please sign in to comment.