Creating and Applying Different Shapes and Patterns : imagefilledrectangle « Graphics Image « PHP






Creating and Applying Different Shapes and Patterns

 
<?php
    $animage = imagecreate (500, 500);
    $white = imagecolorallocate ($animage, 255, 255, 255);
    $black = imagecolorallocate ($animage, 0, 0, 0);
    imagefilledrectangle ($animage, 0, 0, 500, 500, $black);

    $blue = imagecolorallocate ($animage, 0, 0, 255);
    $green = imagecolorallocate ($animage, 0, 255, 0);

    $myvalues = array ("1","2","3","4","5","6");

    $barwidth = (int) (500 / ((count ($myvalues) * 2)+ 1));

    $barheightpernum = (int) (500 / 10);

       imagefilledrectangle ($animage, 1, 300,498, $black);
      
    imagepng ($animage);

    header ("Content-type: image/png");

    imagedestroy ($animage);
?>
  
  








Related examples in the same category

1.Changing colors with a loop
2.Drawing a Filled Rectangle with imagefilledrectangle()
3.Draw a rectangle