function thumbnail($imag e_path,$thumb_p ath,$image_name ,$thumb_width)
{
$src_img = imagecreatefrom jpeg("$image_pa th/$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 = imagecreatetrue color($new_w,$n ew_h);
imagecopyresamp led($dst_img,$s rc_img,0,0,0,0, $new_w,$new_h,i magesx($src_img )
,imagesy($src_i mg));
imagejpeg($dst_ img, "$thumb_pat h/th_$image_name" );
return true;
}
"Ralph Freshour" <ra***@primemai l.com> wrote in message
news:ns******** *************** *********@4ax.c om...
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...