用Imagine打开图像给出“无法根据给定的输入创建图像" [英] opening image with Imagine gives 'An image could not be created from the given input'
问题描述
我正在使用想象来调整图像的大小,并在/tmp
中卷曲后将它们上传:>
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
我的/tmp
中任何以前上传的图像都可以正常工作,但是在上传此图像时
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:
致命错误:未捕获的异常'Imagine \ Exception \ InvalidArgumentException'和消息'无法从给定的输入创建图像'
Fatal error: Uncaught exception 'Imagine\Exception\InvalidArgumentException' with message 'An image could not be created from the given input'
有人知道这个图像引发了异常的问题吗?
这是@hakre要求的print_r(getimagesize($path));
:
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
简而言之,这是一个BMP图像,而GD无法像从该答案中看到的那样处理它,我会尝试ImageMagick/GMagick
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
这篇关于用Imagine打开图像给出“无法根据给定的输入创建图像"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!