8.PHP图像处理
阅读原文时间:2023年07月08日阅读:3

PHP图像处理

GD2

Jpgraph

创建一个画布:

显示一张图片

随机生成验证码:

创建一个柱形图

 SetScale("textlin");     $graph -> yaxis -> scale -> SetGrace(20);     $graph -> SetShadow();     $graph -> img -> SetMargin(40 ,30 ,30 ,40);     $bplot = new BarPlot($datay);     $bplot -> SetFillColor('orange');     $bplot -> value -> Show();     $bplot -> value -> SetFormat('%d');     $graph -> Add($bplot);     $graph -> SetMarginColor("lightblue");     $graph -> title -> Set("tit");     $a = array(1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10 ,11 ,12);     $graph -> xaxis -> SetTickLabels($a);     $graph -> title -> SetFont(FF\_SIMSUN);     $graph -> xaxis -> SetFont(FF\_SIMSUN);     $graph -> Stroke(); ?>

绘制折线图

 img -> SetMargin(50 ,40 ,30 ,40);     $graph -> img -> SetAntiAliasing();     $graph -> SetScale("textlin");     $graph -> SetShadow();     $graph -> title -> Set("tit");     $graph -> title -> SetFont(FF\_SIMSUN ,FS\_BOLD);     $graph -> SetMarginColor("lightblue");     $graph -> yaxis ->title -> SetFont(FF\_SIMSUN);     $graph -> xaxis -> SetPos("min");     $graph -> yaxis -> HideZeroLabel();     $graph -> ygrid -> SetFill(true ,'#EFEFEF@0.5' ,'#BBCCFF@0.5');     $a = array(1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10 ,11 ,12);     $graph -> xaxis -> SetTickLabels($a);     $graph -> xaxis -> SetFont(FF\_SIMSUN);     $graph -> yscale -> SetGrace(20);     $p1 = new LinePlot($datay);     $p1 -> mark -> SetType(MARK\_FILLEDCIRCLE);     $p1  -> mark ->SetFillColor('red');     $p1 -> mark ->SetWidth(4);     $p1 -> SetColor('blue');     $p1 -> SetCenter();     $graph -> Add($p1);     $graph -> Stroke(); ?>

3D饼状图

 SetShadow();     $graph -> title -> Set("tit");     $graph -> title -> SetFont(FF\_SIMSUN ,FS\_BOLD);     $graph -> legend -> SetFont(FF\_SIMSUN ,FS\_NORMAL);     $p1 = new PiePlot3D($data);     $p1 -> SetLegends(array('11','22','33','44','55','66'));     $targ = array("pie3d\_csimex1.php?v=1","pie3d\_csimex1.php?v=2","pie3d\_csimex1.php?v=3","pie3d\_csimex1.php?v=4","pie3d\_csimex1.php?v=5","pie3d\_csimex1.php?v=6");     $alts = array("val=%d" ,"val=%d" ,"val=%d" ,"val=%d" ,"val=%d" ,"val=%d");     $p1 -> SetCSIMTargets($targ ,$alts);     $p1 -> SetCenter(0.4 ,0.5);     $graph -> Add($p1);     $graph -> StrokeCSIM(); ?>

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章