Home > Article > Backend Development > getimagesize gets image size php function
php has a ready-made function getimagesize for getting the size of the image. The specific function usage and code examples:
/* 1.jpg is the picture whose size you want to get */
$arr = getimagesize("1.jpg");
/**
* 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 and 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 */
echo "";
echo "";
?>//Open source software: phpfensi.com