####创建画布 imagecreatetruecolor(宽,高); imagecreatefrompng('文件路径'); imagecreatefromjpeg('文件路径'); imagecreatefromgif('文件路径'); ####分配颜色 imagecolorallocate(资源,红,绿,蓝); ####填充 imagefill(资源,x,y,颜色); ####画点 imagesetpixel(资源,x,y,颜色); ####画线 imageline(资源,x1,y1,x2,y2,颜色); ####画矩形 imagerectangle(资源,x1,y1,x2,y2,颜色); ####画实心矩形 imagefilledrectangle(资源,x1,y1,x2,y2,颜色); ####画椭圆 imageellipse(资源,圆心x,圆心y,宽,高,颜色); ####画实心椭圆 imagefilledellipse(资源,圆心x,圆心y,宽,高,颜色); ####画弧线 imagearc(资源,圆心x,圆心y,宽,高,开始角度,结束角度,颜色); ####画弧线并填充 imagefilledarc(资源,圆心x,圆心y,宽,高,开始角度,结束角度,颜色,IMG_ARC_PIE); ####写字 imagefttext(资源,字体大小,角度,x,y,颜色,字体文件,文本); ####输出图像 header('Content-type:image/png'); header('Content-type:image/jpeg'); header('Content-type:image/gif'); imagepng(资源); imagejpeg(资源); imagegif(资源); ####销毁图像 imagedestroy(资源);
转载于:https://my.oschina.net/phpweishunlong/blog/888755