GD库画图

//创建画布

$huabu = imagecreatetruecolor(600,700);


//创建颜色

$bg = imagecolorallocate($huabu,77,77,77);

$green = imagecolorallocate($huabu,0,255,0);

$red = imagecolorallocate($huabu,255,0,0);

$blue = imagecolorallocate($huabu,0,0,255);

$yellow = imagecolorallocate($huabu,255,255,0);

$xiangkuangbg = imagecolorallocate($huabu,100,0,300);


//填充画布

imagefill($huabu,0,0,$bg);


//==================================================参考坐标


//x坐标

//imageline($huabu,0,350,600,350,$red);

//y坐标

//imageline($huabu,300,0,300,700,$red);


//==================================================绘制花


//花枝

//imagearc($huabu,10,450,360,700,-90,0,$green);

imagearc($huabu,300,230,180,500,180,0,$green);//中枝

imagearc($huabu,300,230,180,500,-90,0,$bg);

imagearc($huabu,302,230,180,500,180,0,$yellow);

imagearc($huabu,302,230,180,500,-90,0,$bg);

imagearc($huabu,295,220,180,300,-150,0,$green);//右枝

imagearc($huabu,295,220,180,300,-50,0,$bg);

imagearc($huabu,295,220,180,310,-150,0,$yellow);//右枝

imagearc($huabu,295,220,180,310,-40,0,$bg);

imagearc($huabu,122,220,180,300,-150,0,$green);//左枝

imagearc($huabu,122,220,182,280,-145,0,$yellow);//左枝


//==================================================绘制花瓶


//花瓶的底

imageline($huabu,150,450,250,450,$green);

//绘制花瓶左边

imagearc($huabu,150,350,30,200,0,270,$green);

imagearc($huabu,150,350,30,200,0,90,$bg);//用背景覆盖多余的90度弧线

//绘制花瓶右边

imagearc($huabu,250,350,30,200,-90,90,$green);

//绘制左边瓶颈

imagearc($huabu,150,220,50,60,0,180,$green);

imagearc($huabu,150,220,50,60,0,90,$bg);

//绘制右边瓶颈

imagearc($huabu,250,220,50,60,0,90,$green);

//绘制瓶口

imageellipse($huabu,200,220,150,20,$green);


//====================================================绘制桌子


//绘制上边

imageline($huabu,100,400,500,400,$green);

//绘制左边

imageline($huabu,100,400,50,500,$green);

//绘制正面矩形

imagerectangle($huabu,50,500,450,520,$green);

//绘制右边

imageline($huabu,500,400,450,500,$green);

imageline($huabu,500,400,500,420,$green);

imageline($huabu,500,420,450,520,$green);


//======================绘制四个脚


//绘制第一个脚

imagerectangle($huabu,110,520,120,600,$green);

//绘制第二个脚

imagerectangle($huabu,70,520,80,640,$green);

//绘制第三个脚

imagerectangle($huabu,390,520,400,640,$green);

//绘制第四个脚

//imagerectangle($huabu,);

imagerectangle($huabu,430,520,440,600,$green);


//========================================================绘制相框


//================绘制相框

$array = array(300,300,340,460,460,460,420,300);

imagefilledpolygon($huabu,$array,4,$xiangkuangbg);


//================相框内容

//$strs = iconv("GB2312","UFT-8","time");

$font = "simkai.ttf";

亚博登录不上亚博国际手机客户端imagettftext($huabu,20,0,260,180,$yellow,$font,"时间正在流逝,从现在开始!");

imagestring($huabu,5,310,300,"GD LIB Study",$yellow);

imagestring($huabu,5,335,360,"Super zhang",$yellow);

imagestring($huabu,5,340,425,"china",$yellow);

imagestring($huabu,4,340,445,"2012.8.11 11:32",$yellow);


//================绘制相框边框

$xkBorder = array(295,295,335,465,465,465,425,295);

imagepolygon($huabu,$xkBorder,4,$yellow);

//================绘制相框支架


$zhijia = array(310,370,270,470,290,460,315,390);

imagefilledpolygon($huabu,$zhijia,4,$blue);


//====================================================输出图片


header("Content-type:image/png");


imagepng($huabu);


imagedestroy($huabu);