getimagesize in php – Get image width and height in PHP

getimagesize in php – The getimagesize() function in PHP is an inbuilt function which is used to get the size of an image. We can easily extract image information from the Image URL using PHP’s predefined function called getimagesize().

getimagesize in php

The getimagesize() function is used to display the size of an image. The getimagesize() function will determine the size of any given image file.

Syntax

list($width, $height, $type, $attr) = getimagesize("pakainfo_v1.jpg");

php getimagesize function – Get image information

Remote File Photos


Example

Array
(
    [0] => 400
    [1] => 150
    [2] => 3
    [3] => width="400" height="150"
    [bits] => 8
    [mime] => image/png
)

Don’t Miss : getimagesize in php

Get image width and height in PHP

code – getimagesize in php

";
echo "Image height: " . $height;
echo "
"; echo "Image type: " . $type; echo "
"; echo "Attribute: " . $attr; ?>

PHP – getimagesize() Function


Results

Array ( [0] => 800 
        [1] => 230 
        [2] => 3 
        [3] => width="800" height="230" 
        [bits] => 8 
        [mime] => image/png )

getimagesize php


getimagesize php

";
?>

For Type of image

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

I hope you get an idea about getimagesize in php.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment