Zend - The PHP Company




Resizing

Add Code


resize image to 50%, 25%  

Type: code fragment
Added by: idban
Entered: 18/03/2000
Last modified: 08/12/1999
Rating: *** (28 votes)
Views: 16139
some time one image use for many pages, like to create a thumbnail etc,
hopely this code usefull for you


<?
/* some time one image use for many pages, like to create a thumbnail etc, hopely this code usefull for you

Jakarta, march 2000 
idban secandri

idban@satunet.com

greeting to :
my wife Dessy 
my friends on satunet.com, satuwanita.com,satumed.com and kafegaul.com
my Adhi eN, Stivi, Edwin, Ewing, System, Mdamt, Made Wiryana
my brother Mohammad Nafiri
my amazing linux box "the kwak" box ;p
*/
?>

<?
$size 
GetImageSize("1234.gif");  // your image
$sizeH2=$size[1]/2;  // 50%
$sizeW2=$size[0]/2// 50% 
$sizeH4=$size[1]/4;   // 25%
$sizeW4=$size[0]/4;  // 25%
?>
<IMG SRC="1234.gif"><br>Original picture<br> 
<? echo"Original H = $size[1] <br> Original W =  $size[0]?>
<br><br><IMG SRC="1234.gif" height="<?echo $sizeH2;?>" width="<?echo $sizeW2;?>" >
<br>1/2 from original<br>
<? echo"1/2 from original H =  $sizeH2 <br>1/2 from original W = $sizeW2?>
<br><br><IMG SRC="1234.gif" height="<?echo $sizeH4;?>" width="<?echo $sizeW4;?>" >
<br>1/4 from original<br>
<? echo"1/4 from original H =  $sizeH4 <br>1/4 from original W = $sizeW4?>


Usage Example


See the example


Rate This Script





Search



This Category All Categories