php.ini中开启extension=php_gd2.dll
<?php $im=imagecreatetruecolor(400,300); $red=imagecolorallocate($im,255,0,0); //imageellipse($im,40,80,20,20,$red); //imageline($im,0,0,400,300,$red); //imagerectangle($im,2,2,40,50,$red); //imagefilledrectangle($im,2,2,40,50,$red); //画弧线,顺时针转多少度 //imagearc($im,100,100,50,50,180,270,$red); //扇形 //imagefilledarc($im,100,100,80,50,180,270,$red,IMG_ARC_PIE); //复制图到画布 //1.加载源图 //$srcImage=imagecreatefromgif("logo.gif"); //2.粘源图到目标画布 //得出图的相关信息 //$imageInfo=getimagesize("logo.gif"); //imagecopy($im,$srcImage,0,0,100,0,106,107); //写字,不能写中文 //imagestring($im,5,0,0,"hello word",$red); //在字体库里的中文字体,请把字体复制到文件下。 $str="不能写中文"; imagettftext($im,30,0,50,50,$red,"你复制的目标字体",$str); header("content-type:image/png"); imagepng($im); imagedestroy($im); ?>