85. php 绘图体系
2016-01-13 22:07
656 查看
1.坐标体系
2.基本原理与步骤
3.实现
2.基本原理与步骤
3.实现
<?php //1.创建画布,默认的背景是黑色 $img = imagecreatetruecolor(400,400); //2.创建颜色 $red = imagecolorallocate($img,255,0,0); //3.画椭圆 //imageellipse($img,100,0,200,200,$red); //画直线 //imageline($img,0,0,400,300,$red); //画空心矩形 //imagerectangle($img,0,0,200,150,$red); //实心矩形 //imagefilledrectangle($img,0,0,200,150,$red); //画弧度 //imagearc($img,200,200,100,100,0,270,$red); //画扇形 //imagefilledarc($img,200,200,100,100,0,270,$red,IMG_ARC_EDGED); //拷贝图片到画布 //1.加载源图片 //$srcImage = imagecreatefrompng('aaa.png'); //2.拷贝原图片到目标画布,这里我们可以使用 getimagesize()方法 //$srcImageInfo = getimagesize('aaa.png'); //imagecopy($img,$srcImage,100,100,30,30,60,60); //imagecopy($img,$srcImage,100,100,0,0,$srcImageInfo[0],$srcImageInfo[1]); //写字 $str = 'hello world 我你'; //imagestring($img,5,0,0,'hello world 我我',$red);//这个方法显示不出中文 //在字体库中找支持中文的字体 imagettftext($img,30,9,0,200,$red,'STSONG.TTF',$str); //输出到网页,也可以另存为 header('content-type:image/png'); imagepng($img); //销毁图片资源,释放服务器内存 imagedestroy($img);
相关文章推荐
- Windows开启NTP服务
- PHP会话管理
- 四大基本组件之ContentProvider
- PHP学习之数组
- 【杭电oj】1096 - A+B for Input-Output Practice (VIII)
- 【杭电oj】1093 - A+B for Input-Output Practice (V)
- 【杭电oj】1090 - A+B for Input-Output Practice (II)
- 【杭电oj】1091 - A+B for Input-Output Practice (III)(注意0,0结束输出)
- thinkphp php审核后返回信息给html
- thinkphp源码解析 (Version 3.1) -2 /Lib/Core/Think.class
- php的json校验json-schema
- php中奖概率算法,可用于刮刮卡,大转盘等抽奖算法
- Laravel 传递数据到视图
- Atitit.导出excel报表的设计与实现java .net php 总
- Atitit.导出excel报表的设计与实现java .net php 总
- Atitit.导出excel报表的设计与实现java .net php 总结
- php.ini配置文件执行时间
- PHP过滤各种html标签
- php中echo等语言结构与函数差异
- php在cli命令行执行exec函数中的top命令正常,浏览器访问无输出