Hi,
I am having problems creating a thumbnail from an uploaded image, my problem is
(i) the quality (ii) the crop
http://welovethedesign.com.cluster.cwcs.co.uk/phpimages/large.jpg http://welovethedesign.com.cluster.cwcs.co.uk/phpimages/thumb.jpg
If you look the quality is very poor and the crop is taken from the top and is not a resize of the original image although the dimesions mean it is in proportion.
The original is 1600px wide by 1100px high.
Any help would be appreciated.
$thumb = $targetPath."Thumbs/".$fileName;
$imgsize = getimagesize($targetFile); $image = imagecreatefromjpeg($targetFile); $width = 200; //New width of image
$height = 138; //This maintains proportions$src_w = $imgsize[0]; $src_h = $imgsize[1];
$thumbWidth = 200; $thumbHeight = 138; // Intended dimension of thumb
// Beyond this point is simply code.
$sourceImage = imagecreatefromjpeg($targetFile); $sourceWidth = imagesx($sourceImage); $sourceHeight = imagesy($sourceImage);
$targetImage = imagecreate($thumbWidth,$thumbHeight); imagecopyresized($targetImage,$sourceImage,0,0,0,0,$thumbWidth,$thumbWidth,imagesx($sourceImage),imagesy($sourceImage));
//imagejpeg($targetImage, "$thumbPath/$thumbName"); imagejpeg($targetImage, $thumb);
chmod($thumb, 0755);