博主信息
博文 4
粉丝 0
评论 0
访问量 4081
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
制作圆饼统计图
薈瞢的博客
原创
1632人浏览过

//创建画布,返回一个资源类型的变量$image,并在内存中开辟一个临时区域
$image = imagecreatetruecolor(100, 100);                //创建画布大小为100x100

//设置图像中所需的颜色,相当于在画画时准备的染料盒
$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);          //为图像分配颜色为白色
$gray = imagecolorallocate($image, 0xC0, 0xC0, 0xC0);           //为图像分配颜色为灰色
$darkgray = imagecolorallocate($image, 0x90, 0x90, 0x90);       //为图像分配颜色为暗灰色
$navy = imagecolorallocate($image, 0x00, 0x00, 0x80);           //为图像分配颜色为深蓝色
$darknavy = imagecolorallocate($image, 0x00, 0x00, 0x50);       //为图像分配颜色为暗深蓝色
$red = imagecolorallocate($image, 0xFF, 0x00, 0x00);           //为图像分配颜色为红色
$darkred = imagecolorallocate($image, 0x90, 0x00, 0x00);       //为图像分配颜色为暗红色

imagefill($image, 0, 0, $white);            //为画布背景填充背景颜色
//动态制作3D效果
for ($i = 60; $i >50; $i--){                //循环10次画出立体效果
   imagefilledarc($image, 50, $i, 100, 50, -160, 40, $darknavy, IMG_ARC_PIE);
   imagefilledarc($image, 50, $i, 100, 50, 40, 75, $darkgray, IMG_ARC_PIE);
   imagefilledarc($image, 50, $i, 100, 50, 75, 200, $darkred, IMG_ARC_PIE);
}

imagefilledarc($image, 50, 50, 100, 50, -160, 40, $navy, IMG_ARC_PIE);      //画一椭圆弧且填充
imagefilledarc($image, 50, 50, 100, 50, 40 , 75, $gray, IMG_ARC_PIE);      //画一椭圆弧且填充
imagefilledarc($image, 50, 50, 100, 50, 75, 200, $red, IMG_ARC_PIE);      //画一椭圆弧且填充

imagestring($image, 1, 15, 55, '34.7%', $white);                //水平地画一行字符串
imagestring($image, 1, 45, 35, '55.5%', $white);                //水平地画一行字符串

//向浏览器中输出一个GIF格式的图片
header('Content-type:image/png');               //使用头函数告诉浏览器以图像方式处理以下输出
imagepng($image);                       //向浏览器输出
imagedestroy($image);                   //销毁图像释放资源

本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学