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



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

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

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

Answer / arvind sharma

we can use getimagesize() function which will rtun the array
of its dimension.

Is This Answer Correct ?    9 Yes 2 No

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

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

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

Answer / divyesh

getimagesize($size, $type, $width, $hieght);

Is This Answer Correct ?    7 Yes 2 No

Post New Answer

More PHP Interview Questions

What is api laravel?

0 Answers  


What is in php 7?

0 Answers  


What are the different data types in javascript?

0 Answers  


Is a number php?

0 Answers  


Do you know what is the use of the function 'imagetypes()'?

0 Answers  






Is null empty php?

0 Answers  


Does winrunner 8.0 or qtp 8.0 supports php

2 Answers  


What are the differences between procedure-oriented languages and object-oriented languages?

6 Answers   ASD Lab, DewSoft,


Explain whether it is possible to share a single instance of a memcache between multiple php projects?

0 Answers  


How is it possible to set an infinite execution time for php script?

0 Answers  


What is action hooks and filter hooks?

0 Answers  


Which array function checks if the particular key exists in the array?

0 Answers  


Categories