Hello. I'm trying to create thumbnails using lib-gd2. I create them successfully, however the quality is very poor. Is there any way to improve this within my code without having to recompile with extra libraries, etc -- the webhosting company will not recompile?
I am using the below code:
function thumbnail( $image_path,$thumb_path, $image_name,$thumb_width)
{
print("here<br>");
print("image_path $image_path<br>");
print("thumb_path $thumb_path<br>");
print("image_name $image_name<br>");
print("thumb_width $thumb_width<br>");
$src_img = imagecreatefromjpeg("$image_path/$image_name");
$origw=imagesx($src_img);
$origh=imagesy($src_img);
$new_w = $thumb_width;
$diff=$new_w/$origw;
$new_h = $diff*($origh);
//$new_h=$new_w;
$dst_img = imagecreate($new_w,$new_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));
imagejpeg($dst_img, "$thumb_path/$image_name");
return true;
}