当我使用php创建图像时,GD有一些问题。GD:php imagepng在图像中创建空白
奇怪的是,它可以在一个服务器上使用PHP版本5.3.1,但不是在PHP 5.2.14版本上。 (我不知道这是否是php版本或GD lib正在这样做。)
此文件是通过转换创建的,并保存在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);
?>
奇怪的是,从未见过这样的事情。您将需要显示一些我认为的验证码代码...如果您省略“内容长度”,会发生什么情况?如果你使用其他一些格式如gif,会发生什么? –
我试过内容的长度,但没有改变。我会尝试GIF,但它不会解决问题。 –
这个怎么样:http://www.php.net/manual/en/function.imagecreatefrompng.php#90364(使用真彩色) – 2011-01-11 19:35:40