🛠Lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.
1.98k
stars
147
forks
source link
Image::class and JPG compatible file formats #259
Closed
forgie1 closed 3 years ago
Version: 3.2.2
Bug Description
Image::save('image-file.jfif', 90)
throwsNette\InvalidArgumentException
Expected Behavior
a) properly save the image, since it is jpg compatible format b) throw
UnknownImageFileException
not aInvalidArgumentException
Possible Solution
change this row: https://github.com/nette/utils/blob/v3.2.2/src/Utils/Image.php#L566 to:
$extensions = array_flip(self::FORMATS) + ['jpg' => self::JPEG] + ['jfif' => self::JPEG];
but there are more compatible JPG formats/file extensions supported by browsers: https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types not only jpg/jpeg/jfif