This article mainly explains PHP to obtain the image size (width, height) function, namely the getimagesize () function.
Syntax: array getimagesize (string filename [, array &imageinfo])
Function: the getimagesize () function will determine any GIF,JPG,PNG,SWF,SWC,PSD,TIFF,BMP,IFF,JP2,JPX,JB2,JPC,XBM or wbmp image file and return the file size, size, A file type and a height/width text string that can be used in markup in a normal HTML file. If the specified image cannot be accessed or is not a valid image, GetImageSize () returns false and produces a e_warning level error.
Note:
(1) This function does not require GD Image library support.
(2) The function can be used to obtain the remote data in addition to the local image or flash information.
Example:
"; echo" Image height ". $height; echo"
"; echo" Image type ". $type; echo"
"Echo" Attribute ". $attr;
The output information is as follows:
Image width 200
Image Height 55
Image Type 1
Image attribute width= "55" height= "
The parameters of the picture type are as follows:
1 = GIF 5 = PSD 9 = JPC = SWC
2 = JPG 6 = BMP = JP2 = IFF
3 = PNG 7 = TIFF (Intel byte order) one = JPX = WBMP
4 = SWF 8 = TIFF (motorola byte order) = JB2 = XBM
Articles you may be interested in
- PHP Gets the client computer screen width, height, resolution method
- A way for JavaScript to get the width and height of a picture
- JS Address bar effect (displays the size of all linked images within the page and the height of the current browser)
- Powerful PHP Image processing class (watermark, transparency, zoom, sharpen, rotate, flip, cut, invert)
- PHP get remote picture and download save to local
- Text area textarea box based on input self-adapting height
- How PHP can turn on compressed output to website to enhance website access speed
- JS determines whether the picture is loaded and gets the width of the image
http://www.bkjia.com/PHPjc/764094.html www.bkjia.com true http://www.bkjia.com/PHPjc/764094.html techarticle This article mainly explains PHP to obtain the image size (width, height) function, namely the getimagesize () function. Syntax: array getimagesize (string filename [, array imageinfo]) function: ...