Skip to content

Commit 5a54ddd

Browse files
committed
Accept AVIF images #10871
1 parent cd39834 commit 5a54ddd

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

src/Model/Traits/Image.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ protected function getBasePath(): string
2828
protected function getAcceptedMimeTypes(): array
2929
{
3030
return [
31+
'image/avif',
3132
'image/bmp',
3233
'image/x-ms-bmp',
3334
'image/gif',
@@ -106,6 +107,7 @@ private function readFileInfo(): void
106107

107108
// Pretty much only SVG is better than WebP
108109
$worseThanWebp = in_array($this->getMime(), [
110+
'image/avif',
109111
'image/bmp',
110112
'image/x-ms-bmp',
111113
'image/gif',

tests/Model/Traits/ImageTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public static function providerSetFile(): iterable
7070
{
7171
yield 'jpg is converted to webp' => ['image.jpg', 400, 400];
7272
yield 'png is converted to webp' => ['image.png', 400, 300];
73+
yield 'avif is converted to webp' => ['image.avif', 400, 299];
7374
yield 'svg is untouched' => ['logo.svg', 445, 488, true];
7475
yield 'webp is untouched' => ['image.webp', 400, 400];
7576
yield 'huge jpg is resized to webp' => ['huge.jpg', 3500, 19];

tests/data/images/image.avif

4.62 KB
Binary file not shown.

0 commit comments

Comments
 (0)