1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-15 10:23:59 +02:00

Normalize parameters in media type & extension encoders

This commit is contained in:
Oliver Vogel
2023-12-23 13:42:15 +01:00
parent b58b4b0e43
commit d87d0e6e1d
2 changed files with 2 additions and 2 deletions

View File

@@ -47,7 +47,7 @@ class FileExtensionEncoder extends AutoEncoder
throw new EncoderException('No encoder found for empty file extension.'); throw new EncoderException('No encoder found for empty file extension.');
} }
return match ($extension) { return match (strtolower($extension)) {
'webp' => new WebpEncoder($this->quality), 'webp' => new WebpEncoder($this->quality),
'avif' => new AvifEncoder($this->quality), 'avif' => new AvifEncoder($this->quality),
'jpeg', 'jpg' => new JpegEncoder($this->quality), 'jpeg', 'jpg' => new JpegEncoder($this->quality),

View File

@@ -43,7 +43,7 @@ class MediaTypeEncoder implements EncoderInterface
*/ */
protected function encoderByMediaType(string $type): EncoderInterface protected function encoderByMediaType(string $type): EncoderInterface
{ {
return match ($type) { return match (strtolower($type)) {
'image/webp' => new WebpEncoder($this->quality), 'image/webp' => new WebpEncoder($this->quality),
'image/avif' => new AvifEncoder($this->quality), 'image/avif' => new AvifEncoder($this->quality),
'image/jpeg' => new JpegEncoder($this->quality), 'image/jpeg' => new JpegEncoder($this->quality),