• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

imagick无法对远程url图片进行编辑问题

php 搞代码 4年前 (2022-01-25) 39次浏览 已收录 0个评论
文章目录[隐藏]

<body>

<code><?phpheader("content-type: image/png");$handle = fopen('http://i3.tietuku.com/2afd667e3eded5e0.png', 'rb');$img = new Imagick();$img->readImageFile($handle);$img->resizeImage(128, 128, 0, 0);echo $img;</code>

大家看我的这段代码,我是按照php官方文档的示例代码写的代码,理论上代码质量是有保障的,但是我还是报出了错误:

<code>( ! ) Fatal error: Uncaught exception 'ImagickException' with message 'Unable to read image from the filehandle' in D:\wampServer\www\test\index.php on line 5( ! ) ImagickException: Unable to read image from the filehandle in D:\wampServer\www\test\index.php on line 5Call Stack#	Time	Memory	Function	Location1	0.0000	139136	{main}( )	..\index.php:02	0.0700	150424	readimagefile ( )	..\index.php:5</code>

我在本地测试是没问题的,可以用 绝对路径 打开图片,进行正常的图片操作。
下面是环境展示:

求各位朋友指点一二,怎么解决这个问题?

%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20

%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20

回复内容:

%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20<body>

<?phpheader("content-type:%20image/png");$handle%20=%20fopen('http://i3.tietuku.com/2afd667e3eded5e0.png', 'rb');$img = new Imagick();$img->readImageFile($handle);$img->resizeImage(128, 128, 0, 0);echo $img;

大家看我的这段代码,我是按照php官方文档的示例代码写的代码,理论上代码质量是有保障的,但是我还是报出了错误:

<code>( ! ) Fatal error: Uncaught exception 'ImagickException'<strong style="color:transparent">来2源gaodaima#com搞(代@码&网</strong><label>搞gaodaima代码</label> with message 'Unable to read image from the filehandle' in D:\wampServer\www\test\index.php on line 5( ! ) ImagickException: Unable to read image from the filehandle in D:\wampServer\www\test\index.php on line 5Call Stack#	Time	Memory	Function	Location1	0.0000	139136	{main}( )	..\index.php:02	0.0700	150424	readimagefile ( )	..\index.php:5</code>

我在本地测试是没问题的,可以用 绝对路径 打开图片,进行正常的图片操作。
下面是环境展示:

求各位朋友指点一二,怎么解决这个问题?


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:imagick无法对远程url图片进行编辑问题

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址