getimagesize

getimagesize -- Get the size of an image

Description

array getimagesize ( string filename [, array imageinfo])

The getimagesize( ) function will determine the size of any GIF , JPG , PNG , SWF , PSD , TIFF or BMP image file and return the dimensions along with the file type and a height / width text string to be used inside a normal HTML IMG tag .

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 .

דוגמה 1 . getimagesize ( file )






דוגמה 2 . getimagesize ( URL )






With JPG images , two extras index are returned : channel and bits . channel will be 3 for RGB pictures , and 4 for CMYK pictures . bits is the number of bits for each color .

If accessing the filename image is impossible , or if it isn' t a valid picture , getimagesize( ) will return NULL and generate a warning .

Currently this will return the different JPG APP markers in an associative Array . Some Programs use these APP markers to embedd text information in images . A very common one in to embed IPTC http : / /www.iptc.org / A very common one in to embed IPTC http : / /www.iptc.org / information in the APP13 marker .

דוגמה 3 . getimagesize returning IPTC




הערה : JPEG2000 support will be added in PHP 4.3 .

See also exif_imagetype( ) , exif_read_data( ) and exif_thumbnail( ) .

URL support was added in PHP 4.0.5