<?php

  $height = 200;
  $width = 200;

// Create an image
  #$im = imagecreate($width,$height);
  #ImageFill($im, 0, 0, $black);
  $im = ImageCreateTrueColor($width, $height);
  #$im = ImageCreateFromJPEG("/home/abu-jeib/proposals/e102Large.jpg");
  #$im = ImageCreateFromGIF("/home/abu-jeib/proposals/logo.gif");

    $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);
    $yellow = ImageColorAllocate ($im, 255, 255, 0);    
    #$white = ImageColorAllocate ($im, 0xff, 0xff, 0xff); // OK
    $black = ImageColorAllocate ($im, 0, 0, 0);
    #$black = ImageColorAllocate ($im, 0x00, 0x00, 0x00); // OK
  
  // Draw image
  ImageFilledRectangle($im,0,0,80,80,$c1);
  imageline($im, 0, 0, $width , $height, $white);
  ImageDashedLine($im, $width-1, 0, 0, $height, $green);
  imageEllipse($im, $width/2, $height/2, 50, 50, $yellow);
  imageArc($im, $width/2, $height/2, 100, 100, 180, 360, $red);
  imagepolygon($im, array(20,20,20,60,60,20),3,$yellow);
  imagepolygon($im, array(100,100,100,150,150,150,150,100),4,$white);

  // Write text
  ImageString($im, 5, 0, 50, "Graphics", $red);

  // output image
  Header('Content-type: image/png');
  ImagePng($im);
  #Header('Content-type: image/gif');
  #ImageGIF($im);
  #ImageJPEG
  #ImageWBMP

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

