I am resampling an image to create a thumbnail and while it works, the thumbnail quality isnt what I expected. Any help is appreciated. Heres my code and a copy of the original image and the newly created thumbnail
$srcimg = ImageCreateFromJPEG($this->UploadImagePath.$image_name) or die("There was a problem opening source image.");
$currwidth = imagesx($srcimg); // Current Image Width
$currheight = imagesy($srcimg); // Current Image Height
if ($currheight > $currwidth) { // If Height Is Greater Than Width
$zoom = $this->UploadThumbWidth / $currheight; // Length Ratio For Width
$newheight = $this->UploadThumbHeight; // Height Is Equal To Max Height
$newwidth = $currwidth * $zoom;
} else { // Otherwise, Assume Width Is Greater Than Height (Will Produce Same Result If Width Is Equal To Height)
$zoom = $this->UploadThumbWidth / $currwidth; // Length Ratio For Height
$newwidth = $this->UploadThumbWidth; // Width Is Equal To Max Width
$newheight = $currheight * $zoom; // Creates The New Height
}
$newimg = ImageCreateTrueColor($newwidth, $newheight) or die("There was a problem creating image.");
ImageCopyResized($newimg, $srcimg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight) or die("There was a problem resizing image.");
ImageJPEG($newimg, $this->UploadThumbPath.thumb_.$image_name) or die("There was a problem saving the thumbnail.");
ImageDestroy($srcimg);
ImageDestroy($newimg);