<?php
//php创建图像
//步骤:
//1、创建画布
$img=imagecreatetruecolor(500,300);
//2、准备颜色:
$white=imagecolorallocate($img,255,255,255);
$black=imagecolorallocate($img,0,0,0);
$red=imagecolorallocate($img,255,0,0);
$green=imagecolorallocate($img,0,255,0);
$blue=imagecolorallocate($img,0,0,255);
$gray=imagecolorallocate($img,200,200,200);
//3、在画布上画图像或文字
//填充灰色
imagefill($img,0,0,$gray);
//在画布上画一个蓝色的圆
imagefilledellipse($img,255,150,200,200,$blue);
//4、输出图像或保存图像
header('Content-Type:image/jpeg');
imagejpeg($img);//保存图像
//imagejpeg($img,'a.jpg');保存到当前路径,图片名为a.jpg
//5、释放画布资源
imagedestroy($img);
?>
?>
绘制图像:
1.填充画布
imagefill();
2.画一个像素
imagesetpixel(;
3.画线
imageline();
4.画一个矩形
imagerectangle(;
5.画一矩形并填充
imagefilledrectangle(;
6.画一个多边形
imagepolygon();
7.画一个多边形并填充
imagefilledpolygon();
8.画一个椭圆
imageellipse();
9.画一个椭圆并填充
imagefilledellipse();
10.画一个椭圆弧
imagearc();
11.画一个椭圆弧并填充
imagefilledarc();
12.画字符串
imagettftext();