Home  >  Article  >  Backend Development  >  getimagesize gets image size instance, _PHP tutorial

getimagesize gets image size instance, _PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:14:01806browse

getimagesize gets the image size instance,

The example in this article describes the method of getimagesize to obtain the image size. Share it with everyone for your reference. The details are as follows:

php has a ready-made function getimagesize for getting the size of an image, code example:

Copy code The code is as follows:
/* 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, 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 "";
?>

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/912279.htmlTechArticlegetimagesize gets the image size example. This example describes how getimagesize gets the image size. Share it with everyone for your reference. The details are as follows: PHP has a ready-made function getimag...
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