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中任何以前上传的图像都可以正常工作,但是在上传此图像时 http://newsimg.bbc.co.uk/media/images/67373000/jpg/_67373987_09f1654a-e583-4b5f-bfc4-f05850c6d3ce.jpg 然后尝试使用Imagine将其打开,则会出现以下错误: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)推荐答案这类似于在这里回答的问题:无法在PHP中从MIME类型为'image/x-ms-bmp'的BMP创建GD图像​​资源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/GMagickTo 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打开图像给出“无法根据给定的输入创建图像"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
05-31 16:33