JDT |
FREE Downloads |
|
Using PHP to Resize an Image |
||||
|
The sample code given below shows how to resize a jpeg image using a PHP script. Resizing images is useful if, for example, you want to use a single image as both a thumbnail and a larger diagram. Here is the first file, which we will call "index.php".
<?php This web page puts the name "box.jpg" in variable "$picture_name". The web page then inserts an image tag, using the PHP script "display_image.php" as the source for the image. Here is the PHP script, "display_image.php":
<?php This script resizes "box.jpg" to 220x220 pixels. Note: I found this script somewhere on the web, but I can't remember where. If you are the author of the script, please let the moderator of this site know, and a link will be placed to your site. Go back to PHP Tutorials home page Go back to Tutorials home page
|
|