Home >Backend Development >PHP Tutorial >php getimagesize function gets image width and height_PHP tutorial
If you want to use PHP to get the height and width of an image, we can directly use the getimagesize function in PHP to operate it. Let me introduce to you in detail how to use the getimagesize function.
The getimagesize() function will determine the size of any GIF, JPG, PNG, SWF, SWC, PSD, TIFF, BMP, IFF, JP2, JPX, JB2, JPC, XBM or WBMP image file and return the dimensions of the image and the file type and a height/width text string that can be used in IMG tags in normal HTML files.
The code is as follows | Copy code | ||||||||
/** * Here $arr is an array type * $arr[0] is the width of the image * $arr[1] is the height of the image * $arr[2] is the format of the image, including jpg, gif, png, etc. * $arr[3] is the width and height of the image, and the content is width="xxx" height="yyy" */
/* The following two lines of code output the same content */ |
The above php code is interpreted as the content is:
The code is as follows | Copy code | ||||
|
http: //www.bkjia.com/PHPjc/445637.html