<? /* send a header so that the browser knows the content-type of the file */ header("Content-type: image/png");
/* set up variables to hold the height and width of your new image */ $newWidth = 35; $newHeight = 35;
/* create a blank, new image of the given new height and width */ $newImg = ImageCreate($newWidth,$newHeight);
/* get the data from the original, large image */ $origImg = ImageCreateFromPNG("test.png");
/* copy the resized image. Use the ImageSX() and ImageSY functions to get the x and y sizes of the orginal image. */ ImageCopyResized($newImg,$origImg,0,0,0,0,$newWidth,$newHeight,ImageSX($origImg),ImageSY($origImg));
/* create final image and free up the memory */ ImagePNG($newImg); ImageDestroy($newImg); ?>