JFIF File sometimes throws error
Hello,
When using jfif image as a source to manipulate using Intervention it's not unambiguous in whether an error is thrown or not.
The encoder does not support jfif mime type but it seems like sometimes it recognizes the image as a jpeg and it that case it does the manipulation without errors. But sometimes it doesn't recognizes it as jpeg and then the expected behaviour of throwing the NotSupportedException occurs.
I'm unable to pinpoint the reason why or how this random behaviour happens.
Thanks in advance!
In my case, I am having this issue on an email template builder plugin which is using this library to resize the image. But unfortunately, it doesn't recognize the jfif mime type which is basically a JPEG file interchange format as per which I edited the AbstractEncoder file exactly here as
....
case 'jpg':
case 'jpeg':
. case 'jfif':
case 'image/jpg':
case 'image/jpeg':
case 'image/pjpeg':
case 'image/jfif':
$this->result = $this->processJpeg();
break;
...
and it worked for me :) Hope this helps
I just created a PR with your fix :)
https://github.com/Intervention/image/pull/1081