php-imagine / Imagine

PHP Object Oriented image manipulation library
https://imagine.readthedocs.io
Other
4.42k stars 530 forks source link

Fix invalid format MIME type definition #835

Closed xdanik closed 1 year ago

xdanik commented 1 year ago

I have discovered that $image->show() was setting invalid Content-Type header. "jpg" in case of "jpg" format instead of "image/jpg".

There seems to be an invalid argument order in the constructor call to Imagine\Image\Format. The constructor signature is: private function __construct($id, $mimeType, $canonicalFileExtension, $alternativeIDs = array())

While callers were clearly setting MIME type into 3. argument instead of second one.

xdanik commented 1 year ago

I have added simple unit test that asserts expected MIME types for a few basic image formats.

vlakoff commented 1 year ago

Nice catch! I noticed you also fixed the file extension for WBMP.