PHP绘图案例讲解二维码制作
发布时间:2020-12-13 17:31:28 所属栏目:PHP教程 来源:网络整理
导读:?phpheader("Content-type: image/png");//声明浏览器解析为图片$width=200;$height=100;$color1=imagecreate($width,$height); //绘制一个画布 imagecolorallocate($color1,60,40);//设置此选项后,画的点或者是线连接之后回成团,带颜色 $color_T=imagecol
<?php header("Content-type: image/png");//声明浏览器解析为图片 $width=200; $height=100; $color1=imagecreate($width,$height); //绘制一个画布 imagecolorallocate($color1,60,40);//设置此选项后,画的点或者是线连接之后回成团,带颜色 $color_T=imagecolorallocate($color1,rand(200,255),255));//随机数取颜色 //矩形边框的颜色 $color_B=imagecolorallocate($color1,255)); //字体颜色 $colorString=imagecolorallocate($color1,rand(10,100),100)); //画点 循环 for($i=0;$i<100;$i++){ imagesetpixel($color1,rand(0,$width-1),$height-1),imagecolorallocate($color1,rand(100,200),200)));//画点函数 } //画线 for ($j=0;$j<5;$j++){ imageline($color1,$width-30),$height),$width/2),200)));//画线函数 } //写字 /* imagestring($color1,50,‘abcf‘,$colorString); *///两个不同的写字函数 imagettftext($color1,30,20,40,$colorString,‘COMSC.TTF‘,‘abcv‘);//两个不同的写字函数 //------------------------------------------------------- imagefill($color1,$color_T);//图像着色 //画一个矩形 imagerectangle($color1,$width-1,$height-1,$color_B); imagepng($color1); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |