源码:
<html>
<head>
<title>PHP 图像测试</title>
</head>
<body>
<?php
#创建背景图像
$im = @imagecreate(500,500) or die("没有安装GD图像库<br>");
#设置背景颜色
$bgCol=imagecolorallocate($im,255,0,0);
#设置字体颜色
$texCol=imagecolorallocate($im,255,255,0);
$motto = "I love my baby! 我家宝贝聪明可爱漂亮";
$motto = iconv("gb2312", "utf-8", $motto);
#在背景图像上输入文字
imagestring($im,3,5,5,$motto,$texCol);
#输出图像
header("Content-Type: image/png");