I'm using the following piece of code to create thumbnmails, it woprks fine apart from the quality of the thumbnails created. Is there an error or is it a server side setting that needs tweaking?? I'm a complete newb when it comes to GD lib.
function thumbjpg($image_path, $thumb_path, $image_name, $thumb_width)
{
$src_img = imagecreatefromjpeg("$image_path/$image_name");
$origw=imagesx($src_img);
$origh=imagesy($src_img);
$new_w = $thumb_width;
$diff=$origw/$new_w;
$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;
}
function thumbgif($image_path, $thumb_path, $image_name, $thumb_width)
{
$src_img = imagecreatefromgif("$image_path/$image_name");
$origw=imagesx($src_img);
$origh=imagesy($src_img);
$new_w = $thumb_width;
$diff=$origw/$new_w;
$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;
}
http://www.iheartuni.com/uploads/funny_pictures/thumbs/20061123863284.jpg
was made from
http://www.iheartuni.com/uploads/funny_pictures/pictures/20061123863284.jpg