All you need to get thumb nails is to use the getimagesize() function in conjunction with list() to obtain the height and width of the image then use a calculation to ensure that the resizing of height and width is not going to result in an image that is out of proportion.
I used something like this for my images
$ext = array("jpg","png","gif","bmp");
foreach($ext as $typ){
$dir = glob("*.{$typ}");
$img = array_combine( $dir , $img);
}
$ratio = 0.33; // approx 1/3rd
foreach($img as $thumb){
list($width, $height, $type, $attr) = getimagesize( $thumb );
$height = $height * $ratio;
$width = $width * $ratio;
echo "<img height='{$height}' width='{$width}' title='' src='{$thumb}'; /><br>\r\n";
}
its been a long time since I looked at the script but thats the basics of what I did.