Home | Scripts | Tutorials | Books | Hosting | Forums | Links|

Navigation:

Home
Source code
Tutorials
RSS feeds
Articles
Wordpress plugins
Books
Sample Chapters
Software
Downloads
Hosting
manuals
Script directory
Training
Our Links






 
 

SPONSORS



 
 

Simple image resizer

This uses the GetImageSize function to get the size of the image you specify . The GetImageSize function returns an array with 4 elements . The elements we are interested in are elements 0 and 1 , these hold the width of the image in pixels for index 0 and index 1 holds the height of the image in pixels . We then simply divide this by 2 to get an image 50% of its original size .

Code :

<?php
//image resizer by myscripting
//get the size of the original
$size = GetImageSize("aspbanner1.gif");
//store the resized dimensions in a variable
$sizeh50 = $size[1]/2;
$sizew50 = $size[0]/2;
?>
Original Image :
<br>
<img src ="aspbanner1.gif">
<br>
Resized image :
<br>
<img src ="aspbanner1.gif" height="<?php echo $sizeh50; ?>" width ="<?php echo $sizew50;?>">

Example :

Original Image :

Resized image :