create a jpeg

This example will create and display a jpeg

<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 a gif
ImageJPEG($img,"pic.jpg");
//clean up resources
ImageDestroy($img);
?>
<img src="pic.jpg" />
</body>
</html>