RE: [PHP] Image Resizing in PHP

From: Date: Fri, 30 Mar 2001 00:53:59 +0000
Subject: RE: [PHP] Image Resizing in PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-46203@lists.php.net to get a copy of this message
Using a GD that has GIF support, you can do this.... <?php // we expect $scale and $image to be defined, having been passed to us via // query string, e.g. http://www.foo.com/img.php3?image=test.gif&scale=4 // create an image object from the source file $srcImg = imagecreatefromgif($DOCUMENT_ROOT . $image); // create a (blank) smaller image object $srcSize = getimagesize($DOCUMENT_ROOT . $image); $dstImg = imagecreate($srcSize[0]/$scale, $srcSize[1]/$scale); // copy and resize from the source image object to the smaller blank one imagecopyresized($dstImg, $srcImg, 0, 0, 0, 0, $srcSize[0]/$scale, $srcSize[1]/$scale, $srcSize[0], $srcSize[1]); // send the smaller image object to the browser header( "Content-Type: image/gif"); imagegif($dstImg); // clean up imagedestroy($scrImg); imagedestroy($dstImg); ?> > -----Original Message----- > From: Jason Murray [mailto:Jason.Murray@melbourneit.com.au] > Sent: Thursday, March 29, 2001 7:49 PM > To: 'Jack Dempsey'; YoBro > Cc: php-general@lists.php.net > Subject: RE: [PHP] Image Resizing in PHP > > > > Perhaps i'm not following what you're trying to do, but why not > > manipulate the height/width img tag attributes to make it > look like a > > thumbnail, but then when displaying it for real, take them out? > > Because then you have to download the entire large image. > > Large images are bigger. :) > > Jason > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net >

« previous php.general (#46203) next »