I found this code on the board, the only trouble is it is not working for me. I think it is the server, so I have included a link to my server info page.
resizeimage.php
<?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);
?>
test.php
<?php
print "<html>\n<head>\n<title>resize test</title>\n</head>\n<body>";
print "<img src=\"resizeimage.php?image=GLRMERHMHWSW.jpg&max_width=50&max_height=77\" border=\"0\">";
print "\n</body>\n</html>";
?>
here you can look at the outcome here,
resizeimage.php
test.php
And my server info can be found at this location.
Thank you for your help.