diff --git a/src/Model/Traits/Image.php b/src/Model/Traits/Image.php index 9f1a372..4acf52f 100644 --- a/src/Model/Traits/Image.php +++ b/src/Model/Traits/Image.php @@ -32,6 +32,8 @@ protected function getAcceptedMimeTypes(): array 'image/bmp', 'image/x-ms-bmp', 'image/gif', + 'image/heic', + 'image/heif', 'image/jpeg', 'image/pjpeg', 'image/png', @@ -111,6 +113,8 @@ private function readFileInfo(): void 'image/bmp', 'image/x-ms-bmp', 'image/gif', + 'image/heic', + 'image/heif', 'image/jpeg', 'image/pjpeg', 'image/png', // We lose animation, even though WebP supports it, but we assume we never use animated PNG anyway diff --git a/tests/Model/Traits/ImageTest.php b/tests/Model/Traits/ImageTest.php index 9e1413b..21b4301 100644 --- a/tests/Model/Traits/ImageTest.php +++ b/tests/Model/Traits/ImageTest.php @@ -71,6 +71,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 'heif is converted to webp' => ['image.heif', 1440, 960]; 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]; diff --git a/tests/data/images/image.heif b/tests/data/images/image.heif new file mode 100644 index 0000000..00cc549 Binary files /dev/null and b/tests/data/images/image.heif differ