For a quick, resize of images on the fly, put the code below in a file called "resizeimage.php"
<?
if (!$max_width)
$max_width = 150;
if (!$max_height)
$max_height = 100;
$size = GetImageSize($image);
$width = $size[0];
$height = $size[1];
$x_ratio = $max_width / $width;
$y_ratio = $max_height / $height;
if (($width <= $max_width) && ($height <= $max_height)) {
$tn_width = $width;
$tn_height = $height;
} elseif (($x_ratio * $height) < $max_height) {
$tn_height = ceil($x_ratio * $height);
$tn_width = $max_width;
} else {
$tn_width = ceil($y_ratio * $width);
$tn_height = $max_height;
}
$src = ImageCreateFromJpeg($image);
$dst = imagecreatetruecolor($tn_width, $tn_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
//USE THE TWO LINES BELOW, IF IMAGECREATETRUECOLOR DOESN'T EXIST
//$dst = ImageCreate($tn_width, $tn_height);
//ImageCopyResized($dst, $src, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
ImageJpeg($dst);
ImageDestroy($src);
ImageDestroy($dst);
?>
Then use this line of code everytime you want to display an image. Just change "ImageName.jpg" to the name/location of your image.
print "<img src=\"resizeimage.php?image=ImageName.jpg&max_width=50&max_height=77\" border=\"0\">";
HTH,
insectis