【发布时间】:2011-06-07 09:29:00
【问题描述】:
当我使用 php 创建图像时,我遇到了一些 GD 问题。
奇怪的是,它可以在一台 php 版本 5.3.1 的服务器上运行,但不能在 php 版本 5.2.14 上运行。 (我不确定是php版本还是GD lib这样做。)
这个文件是用convert创建的,保存在captcha::get_file()的目录中。
而这个文件是用imagecreatefrompng()和imagepng()生成的
我对脚本做了一些小改动并制作了一个 gif。但是png还是有问题
这是什么原因造成的,我该如何解决?
这里是phpcode:
<?php
session_start();
require_once("./captcha.php"));
// creates the image with convert and returns the location of the picture
// document_root/picture/picture.png
$picloc = captcha::get_file();
$image = @imagecreatefrompng($picloc);
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
unlink($picloc);
?>
【问题讨论】:
-
奇怪,以前从未见过这样的事情。您将需要显示一些我认为的验证码...如果省略
content-length会发生什么?如果使用 gif 等其他格式会怎样? -
我尝试了内容长度,但没有任何改变。我会尝试 gif,但它不会解决问题。