我现在已经把GD库配置好了,用phpinfo可以看到GD库已是可用的了,但是我写了以下代码,它却提示我错误信息,很是疑惑啊,请大家指点: <HTML> <HEAD> <TITLE>建立图形</TITLE> </HEAD> <BODY> <? header("Content-type:image/gif"); $image=imagecreate(200,200); $red=imagecolorallocate($image,255,0,0); $blue=imagecolorallocate($image,0,0,255); imagefill($image,0,0,$red); imagerectangle($image,30,30,70,70,$blue); imagecolortransparent($image,$blue); imagegif($image); imagedestroy($image); ?> </BODY> </HTML>它提示我:Warning: Cannot add header information - headers already sent by (output started at c:/php/test1/red.php:6) in c:/php/test1/red.php on line 7Warning: ImageGif: No GIF support in this PHP build in c:/php/test1/red.php on line 14 我不知道错误出现在哪里,请指教,谢过:)
gd 2.0.11的版本也太高了吧?应该用与PHP4.0.4相配套的
下载时不要下载那个一兆多的,那是个简版。要下载五兆以上的包。
php4.1.0出来的时候宣称有版本兼容能力,但实际上不行。
最好是有配置方法,或者有直接可用的.so
<HTML>
<HEAD>
<TITLE>建立图形</TITLE>
</HEAD>
<BODY>
<?
header("Content-type:image/gif");
$image=imagecreate(200,200);
$red=imagecolorallocate($image,255,0,0);
$blue=imagecolorallocate($image,0,0,255);
imagefill($image,0,0,$red);
imagerectangle($image,30,30,70,70,$blue);
imagecolortransparent($image,$blue);
imagegif($image);
imagedestroy($image);
?>
</BODY>
</HTML>它提示我:Warning: Cannot add header information - headers already sent by (output started at c:/php/test1/red.php:6) in c:/php/test1/red.php on line 7Warning: ImageGif: No GIF support in this PHP build in c:/php/test1/red.php on line 14
我不知道错误出现在哪里,请指教,谢过:)
1. 修改 extension_dir , 为你的 php 目錄下的 extensions 的完整路徑 :
例如 : extension_dir ="C:\php\extensions"
2. 把php_gd.dll扩展前面的分号去掉.