How can we get the properties (size, type, width, height) of
an image using PHP image functions?
Answers were Sorted based on User's Feedback
Answer / ansar
exif_imagetype()- for getting type of the image
getimagesize() - for getting size of the image
imagesx - for width
imagesy - for height
| Is This Answer Correct ? | 32 Yes | 6 No |
Answer / arvind sharma
we can use getimagesize() function which will rtun the array
of its dimension.
| Is This Answer Correct ? | 9 Yes | 2 No |
Answer / 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 |
m new to xampp i want to configure file server in xampp... is it possible ??? if so help me....
What is default session time and path in php?
What is include in php?
What does $_files means?
What is full form of PHP?
How to display your correct URL of the current web page?
What is the difference between Joomla and Drupal?
8 Answers IBM, Procon IT Solutions, T3 Softwares,
What is session_start () in php?
How to open a file for reading?
How to fix "headers already sent" error in php
How to increase the maximum execution time of a script in php?
What is constructors and destructors?