Zend - The PHP Company




Graphics

Add Code


Auto specify Image Size  

Type: code fragment
Added by: jsalido
Entered: 08/04/2000
Last modified: 08/12/1999
Rating: **** (11 votes)
Views: 10620
A simple function to avoid having to specify image height and width when putting an image in a web page. Specifying these parameters helps the browser display pages faster.


<?php
function display_img($arch)   
        {
        
$imgsize GetImageSize ("$arch");    
        
$img_w $imgsize[0];       
        
$img_h $imgsize[1];       
        echo 
"<img src="$arch" width="$img_w" heigth="$img_h">";         
        }
?>


Usage Example


<?
display
(abc.jpg);
?>


Rate This Script





Search



This Category All Categories