Hello all, I have this code that takes an image sent from a form and resizes
it for a thumbnail and for display, the problem is the pictures look nice
until this does the resizing, then the quality is horrible...can I fix it?
Thanks,
Eddie
<?
if(!empty($myimage)){
$id=$HTTP_GET_VARS['id'];
$imgname="image_".$id.".jpg";
copy($myimage,$imgname);
unlink($myimage);
function thumbnail($i,$nw,$p,$nn) {
$img=imagecreatefromjpeg("$i");
$ow=imagesx($img);
$oh=imagesy($img);
$scale=$nw/$ow;
$nh=ceil($oh*$scale);
$newimg=imagecreate($nw,$nh);
imagecopyresized($newimg,$img,0,0,0,0,$nw,$nh,$ow,$oh);
imagejpeg($newimg, $nn);
return true;
}
#thumbnail(filetouse,newwidth,newpath,newname);
thumbnail($imgname,100,"/imges/","t_".$imgname);
thumbnail($imgname,250,"/imges/",$imgname);
}
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php