Home  >  Article  >  Backend Development  >  getimagesize gets image size php function

getimagesize gets image size php function

高洛峰
高洛峰Original
2016-11-29 14:52:011086browse

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


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php filter all HTML tagsNext article:php filter all HTML tags