To get the width and height of an image PHP provides a function getimagesize() this function determines the size of image file including flash file(swf).
Syntax
list($width, $height, $type, $attr) = getimagesize("image_name.jpg");
<?php
echo "<img src='http://webmastertrainings.in/images/2012/07/learn-php.png'></br></br>";
list($width, $height, $type, $attr) = getimagesize("http://webmastertrainings.in/images/2012/07/learn-php.png");
echo "Image width, height, type are :-"
echo "Width " .$width;
echo "<BR>";
echo "Height " .$height;
echo "<BR>";
echo "Type " .$type;
echo "<BR>";
echo "Image Attribute " .$attr;
?>
Type of Image are :-
1 = GIF 5 = PSD 9 = JPC 13 = SWC
2 = JPG 6 = BMP 10 = JP2 14 = IFF
3 = PNG 7 = TIFF(intel byte order) 11 = JPX 15 = WBMP
4 = SWF 8 = TIFF(motorola byte order) 12 = JB2 16 = XBM
Syntax
list($width, $height, $type, $attr) = getimagesize("image_name.jpg");
<?php
echo "<img src='http://webmastertrainings.in/images/2012/07/learn-php.png'></br></br>";
list($width, $height, $type, $attr) = getimagesize("http://webmastertrainings.in/images/2012/07/learn-php.png");
echo "Image width, height, type are :-"
echo "Width " .$width;
echo "<BR>";
echo "Height " .$height;
echo "<BR>";
echo "Type " .$type;
echo "<BR>";
echo "Image Attribute " .$attr;
?>
Type of Image are :-
1 = GIF 5 = PSD 9 = JPC 13 = SWC
2 = JPG 6 = BMP 10 = JP2 14 = IFF
3 = PNG 7 = TIFF(intel byte order) 11 = JPX 15 = WBMP
4 = SWF 8 = TIFF(motorola byte order) 12 = JB2 16 = XBM
0 Comments:
Post a Comment