picture help

From: Date: Wed, 18 Jun 2003 20:39:20 +0000
Subject: picture help
Groups: php.general 
Request: Send a blank email to php-general+get-152060@lists.php.net to get a copy of this message
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); } ?>

« previous php.general (#152060) next »