因為研究要用到,又怕時間久了會忘記,所以就把今天試出來的小東西寫上來。

為了偷懶,我不自己安裝Apache + PHP ,而是使用AppServ 2.5.10,這樣一來GD模組也不用自行安裝了。

程式碼如下………!!

<?php

// create a 300*300 image
$img = imagecreatetruecolor(300, 300);

// allocate a color
$white = imagecolorallocate($img, 255, 255, 255);

// draw a circle:實心
// imagefilledarc(底圖, X座標, Y座標, width(寬), height(高),  起始度數, 結束度數, 實心圓顏色, IMG_ARC_PIE);

imagefilledarc($img, 100, 100, 10, 10,  0, 360, $white, IMG_ARC_PIE);

// draw a circle:空心
// imagearc(底圖, X座標, Y座標, width(寬), height(高),  起始度數, 結束度數, 空心圓顏色);

imagearc($img, 200, 200, 10, 10,  0, 360, $white);

// output image in the browser
header("Content-type: image/png");
imagepng($img);

// free memory
imagedestroy($img);

?>

 

以下為輸出網頁的結果:

php_GD_circle

若有錯誤,各位也可以給我建議,謝謝!

arrow
arrow
    全站熱搜

    dreamtails 發表在 痞客邦 留言(0) 人氣()