I'm using Imagine to resize images after uploading them with curl in /tmp
:
$_imagine = new \Imagine\Gd\Imagine();
$mode = \Imagine\Image\ImageInterface::THUMBNAIL_INSET;
$image = $_imagine->open($path); // i.e $path = '/tmp/photo.jpg'
// then resizing the $image
It is working fine with any previously uploaded images in my /tmp
, but when uploading this image http://newsimg.bbc.co.uk/media/images/67373000/jpg/_67373987_09f1654a-e583-4b5f-bfc4-f05850c6d3ce.jpg then trying to open it with Imagine, it gives the following error:
Fatal error: Uncaught exception 'Imagine\Exception\InvalidArgumentException' with message 'An image could not be created from the given input'
Did anybody know what is wrong with this image that makes it throw this exception?
here is the print_r(getimagesize($path));
as asked by @hakre:
Array
(
[0] => 464
[1] => 261
[2] => 6
[3] => width="464" height="261"
[bits] => 32
[mime] => image/x-ms-bmp
)
This is similar to this question answered here: Unable to create GD image resource from BMP with MIME type 'image/x-ms-bmp' in PHP
To put shortly, this is a BMP image, and GD can't handle it as it seems from this answer, i would try ImageMagick / GMagick