diff --git a/docs/formats.md b/docs/formats.md index c118a962..a877587b 100644 --- a/docs/formats.md +++ b/docs/formats.md @@ -13,5 +13,6 @@ The following image formats are tested and supported by the package. If your GD/ | png | ✅ | ✅ | | gif | ✅ | ✅ | | webp | ✅ | ✅ | +| avif | ✅ | ✅ | | heic | ❌ | ✅ | | tiff | ❌ | ✅ | diff --git a/src/Drivers/Gd/GdDriver.php b/src/Drivers/Gd/GdDriver.php index d9c974bc..db9e8a7c 100644 --- a/src/Drivers/Gd/GdDriver.php +++ b/src/Drivers/Gd/GdDriver.php @@ -146,6 +146,9 @@ public function save(?string $path = null): static case 'webp': imagewebp($this->image, $path); break; + case 'avif': + imageavif($this->image, $path); + break; default: throw UnsupportedImageFormat::make($extension); } diff --git a/tests/ImageFormatTest.php b/tests/ImageFormatTest.php index 28597064..b98b07cc 100644 --- a/tests/ImageFormatTest.php +++ b/tests/ImageFormatTest.php @@ -10,7 +10,7 @@ $driver->loadFile(getTestJpg())->save($targetFile); expect($targetFile)->toHaveMime("image/$format"); -})->with('drivers', ['jpeg', 'gif', 'png', 'webp']); +})->with('drivers', ['jpeg', 'gif', 'png', 'webp', 'avif']); it('can save tiff', function () { $format = 'tiff'; diff --git a/tests/Manipulations/QualityTest.php b/tests/Manipulations/QualityTest.php index 00f3e8f3..448906e7 100644 --- a/tests/Manipulations/QualityTest.php +++ b/tests/Manipulations/QualityTest.php @@ -22,5 +22,5 @@ $driver->loadFile(getTestJpg())->quality($quality)->save($targetFile); - expect($targetFile)->toBeFile(); -})->with('drivers')->with(['jpg', 'png', 'webp'])->with([10, 50, 90]); + expect($targetFile)->toBeFile()->toHaveMime("image/$format"); +})->with('drivers')->with(['jpeg', 'png', 'webp', 'avif'])->with([10, 50, 90]);