我在linux上使用灯,在phpinfo上我可以看到gd是启用的。 此代码工作:php,与gd库问题
<?php
header ("Content-type: image/png");
$image = imagecreatefrompng("photo.png");
imagepng($image);
?>
,但是当我试图
<?php
$image = imagecreatefrompng("photo.png");
imagepng($image, "test.png");
?>
我有这样的错误消息:
警告:imagepng(test.png):未能打开流:第3行的/opt/lampp/htdocs/gd/mypage.php中的权限被拒绝
任何想法为什么?
因为您的脚本/脚本运行的用户在该目录中没有写入权限。正如错误所述。 – deceze
您可能想尝试将您正在写入的位置从“test.png”更改为您知道可写的目录(如“/tmp/test.png”)的绝对路径。 – dethtron5000