Re:Image resizing in PHP
| From: | Neil Smith | Date: | Fri, 20 Sep 2002 19:39:40 +0000 |
| Subject: | Re:Image resizing in PHP | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-15929@lists.php.net to get a copy of this message | ||
Hi - I got to the bottom of this a couple of weeks ago so its still fresh :
Once you have GD installed, try this
$newwidth=120;
// New image width
$newheight=150;
// New image height
$imgurl="/path/to/your/image/file.jpeg";
// Wherever you have stored your image, eg /tmp
$size=GetImageSize($imgurl);
// Acquire image width & height from image file : this is an array (0=width, 1=height)
$im1=ImageCreateFromJPEG($imgurl) or die("Could not create image");
// Get image identifier or quit
$im2=ImageCreate($newwidth,$newheight);
// Make new blank image identifier to receive resized image
ImageCopyResized($im2,$im1,0,0,0,0,$newwidth,$newheight,$size[0],$size[1]);
// Does the hard work
header("Content-type:image/jpeg");
// Tell browser the next data is an image
ImageJPEG($im2);
// Actually output the image you just created
Cheers,
Neil Smith.
At 17:03 20/09/2002 +0000, you wrote:
Message-ID: <20020920145649.43815.qmail@web40503.mail.yahoo.com> Date: Fri, 20 Sep 2002 07:56:49 -0700 (PDT) From: kivanc urgancioglu <kiwo1@yahoo.com> To: php-windows@lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: thumbnails Hi, How can I create thumbnails from image files like jpeg ,gif etc.I don't know how to install gd library in windows.Can anyýne help me?