Home > Backend Development > PHP Tutorial > getimagesize gets image size php function

getimagesize gets image size php function

高洛峰
Release: 2016-11-29 14:52:01
Original
1168 people have browsed it

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


Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template