色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

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

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

  <?php  header("content-type","text/html;charset=utf-8");  /*扇形統(tǒng)計(jì)圖*/  $image = imagecreatetruecolor(100, 100);  /*創(chuàng)建畫(huà)布*/    /*設(shè)置畫(huà)布需要的顏色*/  $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);  }  /*畫(huà)橢圓弧并填充*/  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);   /*畫(huà)字符串*/  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、對(duì)圖片進(jìn)行縮放

  <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   設(shè)置圖片縮放的最大寬度  *@param int  $height   設(shè)置圖片縮放的最大高度  */  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)建畫(huà)布*/    $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);  }  /*調(diào)用函數(shù)*/  thumb('1.png');  ?>  <div>    <h4>縮放后的大小</h4>    <img src="test.png" style="border:1px solid red;">  </div>

效果:

php技術(shù)PHP實(shí)現(xiàn)繪制3D扇形統(tǒng)計(jì)圖及圖片縮放實(shí)例,轉(zhuǎn)載需保留來(lái)源!

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

主站蜘蛛池模板: 龙州县| 镇安县| 商南县| 昌图县| 霞浦县| 连云港市| 晴隆县| 隆林| 吴旗县| 苍溪县| 吉安县| 五寨县| 五大连池市| 呼伦贝尔市| 红河县| 东莞市| 桂阳县| 灵丘县| 北流市| 芮城县| 南雄市| 拉萨市| 喀喇| 平邑县| 宁国市| 南京市| 铜山县| 新竹县| 蕉岭县| 富平县| 桓台县| 玛纳斯县| 化德县| 太仆寺旗| 嘉禾县| 涞源县| 新宁县| 富源县| 南昌县| 弋阳县| 灌云县|