以下是我的GD信息
gd
GD Support enabled
GD Version 1.6.2 or higher
FreeType Support enabled
FreeType Linkage with TTF library
JPG Support enabled
PNG Support enabled
WBMP Support enabled
gd
GD Support enabled
GD Version 1.6.2 or higher
FreeType Support enabled
FreeType Linkage with TTF library
JPG Support enabled
PNG Support enabled
WBMP Support enabled
Header("Content-type: image/PNG"); $myip="127.0.0.1";$im = imagecreate(100,35);
$bkg = ImageColorAllocate($im, 220,220,220 ); //背景色
$red = ImageColorAllocate($im, 220,0,0 ); //红色
$blue = ImageColorAllocate($im, 0,0,220 ); //蓝色
for ($i = 0; $i < strlen($myip); $i++) {
imagestring($im, 5, $i*10+5, 0, substr($myip,$i,1), $blue);//ImageColorAllocate($im,rand(5, 255),rand(5, 255),rand(5, 255))改成这样就成了随机色
}
imagestring($im,5,5,10,"----------",$red);
imagestring($im,3,5,20,"Made in China",$red);ImagePNG($im);
ImageDestroy($im); ?>
<? /*for ($i = 0; $i < strlen($myip); $i++) {
imagestring($im, 5, $i*10+10, 0, substr($myip,$i,1), ImageColorAllocate($im,rand(5, 255),rand(5, 255),rand(5, 255)));
}
:将字串"127.0.0.1"一个字个字的分别以不同的随机色画出.
imagestring(资源变量,大小,左距,顶距,字符串变量,颜色值).
rand(5, 255)产生5-255之间的数值.*/
?>
关键还是要解决配置问题,
怎样才能让服务器把image/PNG格式的文件也可以显示出来