Using imagefilledarc() : imagefilledarc « Graphics Image « PHP






Using imagefilledarc()

 
<?php
    define("WIDTH", 300);
    define("HEIGHT", 300);

    $img = imagecreate(WIDTH,HEIGHT);
    $bg = $white = imagecolorallocate($img, 0xFF, 0xFF, 0xFF);
    $black = imagecolorallocate($img, 0, 0, 0);

    $center_x = (int)WIDTH/2;
    $center_y = (int)HEIGHT/2;
    imagerectangle($img, 0, 0, WIDTH-1, HEIGHT-1, $black);
    imagefilledarc($img,
                   $center_x,
                   $center_y,
                   WIDTH/2,
                   HEIGHT/2,
                   0,
                   90,
                   $black,
                   IMG_ARC_PIE);

    header("Content-Type: image/png");
    imagepng($img);

?>
  
  








Related examples in the same category

1.Creating a Pie Graph Using imagefilledarc()
2.Ellipses and circles