在本地主机上,此代码运行良好:
$im = imagecreatefrompng('BBcode.png');但是当我在服务器中使用相同的代码时
$im = imagecreatefrompng('http://lazertag.elitno.net/drupal/BBcode.png');我收到了折叠式错误:
警告: imagecreatefrompng(http://lazertag.elitno.net/drupal/BBcode.png) function.imagecreatefrompng:未能打开流: HTTP请求失败!HTTP/1.11330346行/www/elitno.net/l/a/lazertag/home/site/drupal/renderImage.php中的禁忌
我该怎么解决这个问题?
发布于 2011-09-17 12:51:27
如果文件位于服务器上,则使用(相对)系统路径,而不是url:例如:
$im = imagecreatefrompng('drupal/BBcode.png');发布于 2011-09-17 12:29:03
在使用imagecreate之前,可以将远程图像下载到本地文件夹中然后进行处理吗?!
你的前任:
$imagefile = file_get_contents('http://lazertag.elitno.net/drupal/BBcode.png');
$fp = fopen('./BBcode.png', 'w+'));
fputs($fp, $imagefile);
fclo$fp);
unset($imagefile);
$im = imagecreatefrompng('./BBcode.png');发布于 2011-09-17 12:33:05
403禁忌表示服务器阻止您访问该文件。您可以尝试执行一个file_get_contents(“http://...."”);一定要得到一条错误消息,也许站点的创建者设置了一个错误消息,否则您必须与他们交谈。
https://stackoverflow.com/questions/7454695
复制相似问题