Skip to content

Commit

Permalink
Accept HEIF images
Browse files Browse the repository at this point in the history
Fixes #20
  • Loading branch information
PowerKiKi committed Nov 12, 2024
1 parent 5a54ddd commit 6813145
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Model/Traits/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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
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 @@ -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];
Expand Down
Binary file added tests/data/images/image.heif
Binary file not shown.

0 comments on commit 6813145

Please sign in to comment.