Hi, I have a function that I use within my upload script that creates a thumbnail of each image that is uploaded (using php's GD library). The problem is, the thumbnails look absolutely horrible. They are not so much distorted, but just VERY blurry. Here is my function that is creating the thumbnails:
function create_thumb($pathToImage, $pathToThumb, $thumbWidth)
{
$img = imagecreatefromjpeg($pathToImage);
$width = imagesx($img);
$height = imagesy($img);
$new_width = $thumbWidth;
$new_height = floor($height * ($thumbWidth / $width));
$tmp_img = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($tmp_img, $pathToThumb);
imagedestroy($tmp_img);
imagedestroy($img);
}
create_thumb('uploads/' . $name, 'uploads/thumbs/' . $name, 100);
echo "1";
}
I have googled about this, and everything I read just tells me to make sure I have the newest version of the GD library, to use imagecopyresample (instead of imagecopyresize) and to use imagecreatetruecolor (instead of imagecreate). Which, as you can see, I do use all of those.
Any help is appreciated!