<?php
//header tells browser what type of data will follow
header("Content-type: image/gif");
//tells php where gd library is installed
dl("c:/program files/php/extensions/php_gd2.dll");
//width of the resized image
$new_w=164;
//height of the resized image
$new_h=61;
//sets the size of the new image
//We have used ImageCreate( ) before remember?
$dst_img = ImageCreate($new_w,$new_h);
//function for creating a new image from an existing image
//Note: D:/phpweb/hotspot.gif is the location of my image, so change it to yours
$src_img = ImageCreateFromGif("D:/program files/apache group/apache2/htdocs/hotspot.gif");
//ImageSX gets image width, ImageSY gets height
//All the parameters should be self explanatory except maybe the 0,0,0,0
//the first two 0,0 are the x,y coordinates of the destination image
//the third and 4th zeros are the x,y coordinates of the source image.
//if you use values other than zeros, it means the image will be cropped.
ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img));
ImageGif($dst_img,"new_image.gif");
?>
<img src=new_image.gif />