function thumbnail($image_path,$thumb_path,$image_name,$thu mb_width)
{
$src_img = imagecreatefromjpeg("$image_path/$image_name");
$origw=imagesx($src_img);
$origh=imagesy($src_img);
if ($origw>$origh)
{
$new_w = $thumb_width;
$diff=$new_w/$origw;
$new_h=$origh*$diff;
}
else
{
$new_h = $thumb_width;
$diff=$new_h/$origh;
$new_w=$origw*$diff;
}
$dst_img = imagecreatetruecolor($new_w,$new_h);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$new_ w,$new_h,imagesx($src_img)
,imagesy($src_img));
imagejpeg($dst_img, "$thumb_path/th_$image_name");
return true;
}
"Ralph Freshour" <ra***@primemail.com> wrote in message
news:ns********************************@4ax.com...
I'm trying to figure out how to write some php code that will allow me
to resize a .jpg image and maintain it's aspect ratio - any help or
idea's would be appreciated.
Thanks...