Friday, 5 June 2015

PHP: Display the dimensions of an image using the GD library

<?php
//this is the image to check , change this
if($img = @GetImageSize("testimage.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";
}
?>

0 comments:

Post a Comment