使用GD2函数在照片上添加文字出现错误~
程序员文章站
2022-06-01 22:56:49
...
出现这样的错误怎么解决啊,试了好多办法都不行。!
Warning: imagecreatefromjpeg(/images/photo.jpg): failed to open stream: No such file or directory in C:\Apache24\htdocs\Excerse\index.php on line 3
Warning: imagecolorallocate() expects parameter 1 to be resource, boolean given in C:\Apache24\htdocs\Excerse\index.php on line 4
Warning: imagettftext() expects parameter 1 to be resource, boolean given in C:\Apache24\htdocs\Excerse\index.php on line 7
Warning: imagejpeg() expects parameter 1 to be resource, boolean given in C:\Apache24\htdocs\Excerse\index.php on line 8
Warning: imagedestroy() expects parameter 1 to be resource, boolean given in C:\Apache24\htdocs\Excerse\index.php on line 9
Warning: imagecreatefromjpeg(/images/photo.jpg): failed to open stream: No such file or directory in C:\Apache24\htdocs\Excerse\index.php on line 3
Warning: imagecolorallocate() expects parameter 1 to be resource, boolean given in C:\Apache24\htdocs\Excerse\index.php on line 4
Warning: imagettftext() expects parameter 1 to be resource, boolean given in C:\Apache24\htdocs\Excerse\index.php on line 7
Warning: imagejpeg() expects parameter 1 to be resource, boolean given in C:\Apache24\htdocs\Excerse\index.php on line 8
Warning: imagedestroy() expects parameter 1 to be resource, boolean given in C:\Apache24\htdocs\Excerse\index.php on line 9
回复讨论(解决方案)
Warning: imagecreatefromjpeg(/images/photo.jpg): failed to open stream: No such file or directory in C:\Apache24\htdocs\Excerse\index.php on line 3
failed to open stream: No such file or directory 打开失败:没有这样的文件或目录
提示图片不存在,获取不到图片资源,接下来都报错了
检查下文件路径
我的路径是正确的,我只是搞不明白为什么我在DreamWeaver可以正常运行代码,在ZendStudio却不行。
用IDE运行会有偏差的,还是用浏览器运行吧。浏览器运行没问题就行。
问题解决啦。好像是文件目录的权限问题。我的php网页如果在图片目录级别之上,就可以。但如果在同一级别或者低于图片目录级别,就加载不了。~谢谢各位了。