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

Navigation:

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






 
 

SPONSORS



 
 

Display the dimensions of an image

In this example we use the GetImageSize function again and this time we will display the width and height of the image . GetImageSize returns an array of 4 elements for this example the first two elements 0 and 1 are the ones we will be using . In index 0 we have the width which is measured in pixels and in index 1 we have the height again measured in pixels .

Once again you need the GD library installed and operating correctly .

Code :

<?php
//this is the image to check , change this
if($img = @GetImageSize("ihcomputing1.gif"))
{
//if image exists display the following information
echo "image exists , here is some info<br>";
//display width in pixels
echo "width = $img[0]<br>";
//display height in pixels
echo "height = $img[1]<br>";
}
else
{
//cant find image message
echo"image does not exist";
}
?>

Example :

 

image exists , here is some info
width = 468
height = 60