how could i resize image in PHP

From: Date: Wed, 13 Mar 2002 12:56:21 +0000
Subject: how could i resize image in PHP
Groups: php.general 
Request: Send a blank email to php-general+get-88320@lists.php.net to get a copy of this message
hello, how clud i resize images im php with the , is the script below rezize it if it work where shuld i place this script? can i give relate path for the jpg file? is it need to place this script in a php file call this in the <img src="filename.php"> please help Header("Content-type: image/jpeg"); // $size and $string are passed from the URL //$font = "/home/joel/public_html/ARIALBD.TTF"; // load the font $im = imagecreatefromjpeg("../images/6/62/621345_0.jpg"); // create the source image from jpeg file if(ImageSX($im) > ImageSY($im)) // image is wider than it is tall { $width = $size; $height = $width * (ImageSY($im) / ImageSX($im)); } else // image is taller than it is wide, or both dimensions are the same { $height = $size; $width = $height * (ImageSX($im) / ImageSY($im)); } $im2=ImageCreate($width, $height); // create the destination image, with the correct dimensions $white = ImageColorAllocate ($im2, 255, 255, 255); // allocate a white color $black = ImageColorAllocate ($im2, 0, 0, 0); // allocate a black color imagecopyresized($im2, $im, 0,0,0,0, $width, $height, ImageSX($im), ImageSY($im)); // do the resizing //$text_size = ImageTTFBBox(12, 0, $font, $string); //ImageTTFText ($im2, 12, 0, $width - 6 - $text_size[4], $height - 6 - $text_size[1], $white, $font, $string); Imagejpeg($im2,'', 75); // display the new, resized image ImageDestroy($im); ImageDestroy($im2); regards vishak _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com

« previous php.general (#88320) next »