四虎精品视频-四虎精品成人免费网站-四虎黄色网-四虎国产视频-国产免费91-国产蜜臀97一区二区三区

PHP實現(xiàn)繪制3D扇形統(tǒng)計圖及圖片縮放實例

1、利用php gd庫的函數(shù)繪制3D扇形統(tǒng)計圖

  <?php  header("content-type","text/html;charset=utf-8");  /*扇形統(tǒng)計圖*/  $image = imagecreatetruecolor(100, 100);  /*創(chuàng)建畫布*/    /*設置畫布需要的顏色*/  $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--)  {    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, $darknavy, IMG_ARC_PIE);  imagefilledarc($image, 50, 50, 100, 50, 40, 75, $darkgray, IMG_ARC_PIE);  imagefilledarc($image, 50, 50, 100, 50, 75, 200, $darkred, IMG_ARC_PIE);   /*畫字符串*/  imagestring($image, 3, 15, 55, "30%", $white);  imagestring($image, 3, 45, 35, "60%", $white);  imagestring($image, 3, 60, 60, "10%", $white);   /*輸出圖像*/  header("content-type:image/png");  imagepng($image);   /*釋放資源*/  imagedestroy($image);  ?>

效果:

2、對圖片進行縮放

  <div>    <h4>原圖大小</h4>    <img src="1.png" style="border:1px solid red;">  </div>  <?php  header("content-type","text/html;charset=utf-8");    /*  *圖片縮放  *@param string $filename  圖片的url  *@param int  $width   設置圖片縮放的最大寬度  *@param int  $height   設置圖片縮放的最大高度  */  function thumb($filename,$width=130,$height=130)  {    /*獲取原圖的大小*/    list($width_orig,$height_orig) = getimagesize($filename);     /*根據(jù)參數(shù)$width和$height,換算出等比例的高度和寬度*/    if($width && ($width_orig < $height_orig))    {      $width = ($height / $height_orig) * $width_orig;    }    else    {      $height = ($width / $width_orig) * $height_orig;    }     /*以新的大小創(chuàng)建畫布*/    $image_p = imagecreatetruecolor($width, $height);     /*獲取圖像資源*/    $image = imagecreatefrompng($filename);     /*使用imagecopyresampled縮放*/    imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);     /*保存縮放后的圖片和命名*/    imagepng($image_p,'test.png');     /*釋放資源*/    imagedestroy($image_p);    imagedestroy($image);  }  /*調用函數(shù)*/  thumb('1.png');  ?>  <div>    <h4>縮放后的大小</h4>    <img src="test.png" style="border:1px solid red;">  </div>

效果:

php技術PHP實現(xiàn)繪制3D扇形統(tǒng)計圖及圖片縮放實例,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 电影《地狱天堂》鬼片| 炊事班班长述职报告| 奋进的旋律演员表名单| 神经内科出科小结| 韩国一级黄色录像| 谍影非凡 电影| 砵兰街大少国语版免费观看| 欧美乱淫av片免费黑鬼| 结婚四年未见面,军官老公回来了| 一江春水向东流 电视剧| 小孩打屁股针视频| 郑荣植个人资料| 我的公公电影| 黄色影视影片| 玛姬·格蕾斯| dnf代码大全| 视频三级| 钟思华| 我金子般的孩子| 鲁班书咒语大全| 美女拉屎| 好男当家 电视剧| 沉默的较量| 高手论坛| footjob videos| 黑凤凰电视剧剧情介绍| 浙江卫视节目在线观看直播| 消防知识问答100题| 希比·布拉奇克| yoshizawa akiho| 唐人街探案免费观看完整版| 一声所爱·大地飞歌| 40hq| 电影丑闻| 二年级aab词语| 碑文格式范例 墓碑图片| 宇宙刑事卡邦| 南来北往演员| 杂牌摄像头软件通用app| 陕西卫视节目表| 勇士之门 电影|