Home >Backend Development >PHP Tutorial >PHP function getimagesize gets image size (example)

PHP function getimagesize gets image size (example)

WBOY
WBOYOriginal
2016-07-25 08:52:28863browse
  1. /* 1.jpg is the image whose size you want to get*/

  2. $arr = getimagesize("1.jpg") ;
  3. /**
  4. * Here $arr is an array type
  5. * $arr[0] is the width of the image
  6. * $arr[1] is the height of the image
  7. * $arr[2] is the format of the image, including jpg, gif, png, etc.
  8. * $arr[3] is the width and height of the image, and the content is width="xxx" height="yyy"
  9. */
  10. /* The following two lines of code output the same content*/
  11. echo "echo "";
  12. ?>
Copy the code

After explaining the above code, it will look as follows:

Copy code


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