RE: [PHP] picture help
| From: | Boaz Yahav | Date: | Wed, 18 Jun 2003 21:38:52 +0000 |
| Subject: | RE: [PHP] picture help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-152061@lists.php.net to get a copy of this message | ||
This might help :
array img_resize(string 'path to source image', string 'path to
destination image', string mode, int size);
modes:
"h" - Height
"w" - Width
"a" - auto (resizes by the largest dimension)
http://examples.weberdev.com/get_example.php3?count=157
Sincerely
berber
Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.
-----Original Message-----
From: Edward Peloke [mailto:epeloke@echoman.com]
Sent: Wednesday, June 18, 2003 10:39 PM
To: Php-General@Lists. Php. Net
Subject: [PHP] picture help
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