create a gif

This example shows how to create a basic gif

<html>
<body>
<?php
//create an image 400 by 200 pixels
$img = imagecreate(400,200);
//set variable $red to be red
$red = imagecolorallocate($img,255,0,0);
//draw a rectangle
Imagerectangle($img,50,50,150,150,$red);
//create apng
ImageGIF($img,"pic.gif");
//clean up resources
ImageDestroy($img);
?>
<img src="pic.gif" />
</body>
</html>