Skip to content

Commit

Permalink
add avif support
Browse files Browse the repository at this point in the history
  • Loading branch information
ariaieboy committed Dec 15, 2023
1 parent 7f90997 commit 4b28f80
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/Drivers/Gd/GdDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ImageFormatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions tests/Manipulations/QualityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

0 comments on commit 4b28f80

Please sign in to comment.