Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How can we get the properties (size, type, width, height) of
an image using PHP image functions?

Answer Posted / kartihk

getimagesize ( string filename [, array imageinfo])

Returns an array with 4 elements.
Index 0 contains the width of the image in pixels.
Index 1 contains the height.
Index 2 a flag indicating the type of the image. 1 = GIF, 2
= JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel
byte order), 8 = TIFF(motorola byte order, 9 = JPC, 10 =
JP2, 11 = JPX.
Index 3 is a text string with the correct height="yyy"
width="xxx" string that can be used directly in an IMG tag.

<?php
$imgp = getimagesize ("img/flag.jpg");
echo "<img src=\"img/flag.jpg\" {$imgp[3]}>";
?>

Is This Answer Correct ?    9 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which operator is used to concatenate two strings in PHP?

1032


Where sessions stored in PHP?

980


Tell us how to create an array of a group of items inside an html form?

974


Explain NULL?

1029


Can I include php in javascript?

1063


where do we use htaccess?

985


How to convert a character to an ascii value?

1098


What are new features in php 7?

999


What is the difference between for and foreach in php?

1039


What is the purpose of the '.frm' file extension? What do thes file contain?

961


How to generate a character from an ascii value?

1188


Does facebook use php framework?

1003


Which function will suitably replace 'x' if the size of a file needs to be checked? $Size=x(filename);

991


What is an associative array?

1040


How do you call a constructor for a parent class?

898