Skip to content

Commit

Permalink
Normalize parameters in media type & extension encoders
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Dec 23, 2023
1 parent b58b4b0 commit d87d0e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Encoders/FileExtensionEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected function encoderByFileExtension(?string $extension): EncoderInterface
throw new EncoderException('No encoder found for empty file extension.');
}

return match ($extension) {
return match (strtolower($extension)) {
'webp' => new WebpEncoder($this->quality),
'avif' => new AvifEncoder($this->quality),
'jpeg', 'jpg' => new JpegEncoder($this->quality),
Expand Down
2 changes: 1 addition & 1 deletion src/Encoders/MediaTypeEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function encode(ImageInterface $image): EncodedImageInterface
*/
protected function encoderByMediaType(string $type): EncoderInterface
{
return match ($type) {
return match (strtolower($type)) {
'image/webp' => new WebpEncoder($this->quality),
'image/avif' => new AvifEncoder($this->quality),
'image/jpeg' => new JpegEncoder($this->quality),
Expand Down

0 comments on commit d87d0e6

Please sign in to comment.