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:[EMAIL PROTECTED]]
> Sent: Thursday, March 29, 2001 7:49 PM
> To: 'Jack Dempsey'; YoBro
> Cc: [EMAIL PROTECTED]
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: 
> [EMAIL PROTECTED]
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to