<?php

  $height = 400;
  $width = 400;

// Create an image
   $im = ImageCreateTrueColor($width, $height);

    $yellow = ImageColorAllocate ($im, 255, 255, 0);
    $c1 = ImageColorAllocate($im, 50, 100, 150);
    $blue = imagecolorallocate($im, 0, 0, 255);
    $green = imagecolorallocate($im, 0, 255, 0);
    $red = imagecolorallocate($im, 255, 0, 0);
    $white = ImageColorAllocate ($im, 255, 255, 255);
    $black = ImageColorAllocate ($im, 0, 0, 0);
    $yellow = ImageColorAllocate ($im, 255, 255, 0);
    #imagecolortransparent($im,$white);

  // Draw image
  for ($i=0;$i<15;$i=$i+2)
  {
	if ($i % 4 == 0)
  		ImageFilledRectangle($im,$i,$i,400-$i,400-$i,$black);
	else
		ImageFilledRectangle($im,$i,$i,400-$i,400-$i,$red);
  }
  ImageFilledRectangle($im,15,15,385,385,$c1);
  ImageFilledRectangle($im,25,25,375,375,$white);
  ImageFilledRectangle($im,30,30,370,370,$c1);
  ImageRectangle($im,40,40,360,360,$white);
  ImageFilledRectangle($im,50,50,350,350,$white);
  ImageFilledPolygon($im,array(50,200,200,50,350,200,200,350),4,$black);
  imageline($im, 1, 0, $width , $height-1, $red);
  imageline($im, 0, 0, $width , $height, $blue);
  imageline($im, 0, 1, $width-1 , $height, $red);
  ImageDashedLine($im, $width-1, 0, 0, $height, $blue);
  ImageDashedLine($im, $width-2, 0, 0, $height-1,$blue);
  ImageDashedLine($im, $width-3, 0, 0, $height-2, $red);

  imageFilledEllipse($im, $width/2, $height/2, 230, 230, $blue);
  imageFilledArc($im,$width/2,$height/2,200,130,90,360,$red,IMG_ARC_PIE);
  imageFilledArc($im,$width/2+4,$height/2+4,200,130,0,90,$red,IMG_ARC_PIE);
  ImageFilledPolygon($im,array(0,0,50,0,0,50),3,$blue);
  ImageFilledPolygon($im,array(350,0,400,0,400,50),3,$blue);
  ImageFilledPolygon($im,array(400,350,400,400,350,400),3,$blue);
  ImageFilledPolygon($im,array(0,350,0,400,50,400),3,$blue);

  // Write text
  #ImageString($im, 5, 138, 70, "Graphics in PHP", $red);
  ImageString($im, 5, 75, 55, "CSIT", $blue);
  ImageString($im, 5, 290, 55, "207", $blue);
  ImageString($im, 5, 75, 335, "Fall", $blue);
  ImageString($im, 5, 290, 335, "2006", $blue);
  for ($j=100; $j < 130; $j=$j+5)
	for ($i=195;$i<205;$i++)
		ImageSetPixel($im,$i,$j,$yellow);
  for ($j=275; $j < 305; $j=$j+5)
	 for ($i=195;$i<205;$i++)
               ImageSetPixel($im,$i,$j,$yellow);

  ImageSetThickness($im,2);
  ImageArc($im,0,0,100,100,0,90,$blue);
  ImageArc($im,$width,0,100,100,90,180,$blue);
  ImageArc($im,0,$height,100,100,370,360,$blue);
  ImageArc($im,$width,$height,100,100,180,270,$blue);

  $im = ImageRotate($im,45,$yellow);

  // output image
  Header('Content-type: image/png');
  ImagePNG($im);

  // Save image to a file
  #ImagePNG($im,"/home/abu-jeib/proposals/abc.png");
  
  // Free memory 
  ImageDestroy($im);
?>

