I have a website for which i built an administration interface which allows admin to upload a jpeg image which is used to create a thumbnail image.
My problem is i find that the thumbnail isnt as crisp as it should be...its so fuzzy.
http://www.langstonroach.com/products.php?CATID=3
now its not really the image were looking at here its the text as compared to a thumbnail created by a graphic application like photoshop/ fireworks.
if you've looked at the link above the "perk" image was created with the gd library while the others were from a pplication software.
I have done this before but it hasnt really affected it as much as this has
my code to create the thumbnail is
Code: Select all
// Thumbnail function
function ImageResize($filename,$URL,$width,$height,$border=false){
// build image
$img = imagecreatefromjpeg($URL);// image to use
// get image size
$img_width = imagesx($img);
$img_height = imagesy($img);
// work out ratio
$new_width = $width;
if(!$height)
$new_height = ceil($img_height / ($img_width / $width));
else $new_height = $height;
$new_image = imagecreatetruecolor($new_width, $new_height); // blank image
imagecopyresized($new_image,$img,0,0,0,0,$new_width,$new_height,$img_width,$img_height);
// draw border
if($border != false){
$bordercolor = imagecolorallocate($new_image, 174, 212, 242); // create colour
imagesetthickness($new_image,4);
imageline ($new_image, 0, 0, $new_width, 0, $bordercolor); // top border
imageline ($new_image, $new_width-1, 0, $new_width-1, $new_height, $bordercolor); // right border
imageline ($new_image, 0, $new_height-1, $new_width, $new_height-1, $bordercolor); // bottom border
imageline ($new_image, 0, 0, 0, $new_height, $bordercolor); // left border
}
// lose original image
//umask(0);
//@chmod($filename);
if(file_exists($filename))
@unlink($filename);
// save image
imagejpeg($new_image,$filename,75);
imagedestroy($new_image);
// if save successful return true
if(file_exists($filename))
return true;
else return false;
}Kendall