Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

php getimagesize function - Get Image Information

php getimagesize function - Get Image Information

PHP Image ProcessingPHP Image Processing

The getimagesize() function is used to get the image size and related information. On success it returns an array; on failure it returns FALSE and generates an E_WARNING level error message.

Syntax format:

array getimagesize ( string $filename [, array &$imageinfo ] )

The getimagesize() function determines the size of any GIF, JPG, PNG, SWF, SWC, PSD, TIFF, BMP, IFF, JP2, JPX, JB2, JPC, XBM, or WBMP image file and returns the image dimensions, file type, and image height and width.

Example 1: Local image file





The output of the above example is:



宽度为:290

高度为:69

类型为:3

属性:width="290" height="69"

Example 2: Remote image file





The output of the above example is:



Array

(

    [0] => 290

    [1] => 69

    [2] => 3

    [3] => width="290" height="69"

    [bits] => 8

    [mime] => image/png

)

Return value description

PHP Image ProcessingPHP Image Processing