Responsive Advertisement

Intervention Image - how to upload images with MIME type: application/octet-stream

Im using Laravel framework with Intervention Image library to upload and process images on my page. Everything works fine until I try to update .jpg images taken from mobile devices or from cameras. These images have MIME type application/octet-stream instead of image/jpeg. When I try to upload image with this command:
Image::make($thumb)->resize($this->twidth, $this->theight)->save($this->destination."/".$filename);
I get error:
Unable to read image from file
One uncomfortable solution is open that images in MS Paint and resave them, which will change MIME type to 'image/jpeg' and make it possible to upload it. But I would like to evade this solution at all cost.
EDIT:
I was trying to fix it by this command:
$img = imagecreatefromstring($thumb);
but it returns error: imagecreatefromstring(): Empty string or invalid image
Is there a way how to handle this type of images?

Answer


Post a Comment

0 Comments