Home > Backend Development > PHP Tutorial > Example of using getimagesize to obtain size information of pictures, flash and other files in PHP_PHP Tutorial

Example of using getimagesize to obtain size information of pictures, flash and other files in PHP_PHP Tutorial

WBOY
Release: 2016-07-13 10:31:36
Original
963 people have browsed it

If you still want to get the size information of the flash file by parsing the swf file header information, then you are really going a bit far. Because starting from PHP 4, the getimagesize function has been built-in to do this. Its function determines the size of any GIF, JPG, PNG, SWF, SWC, PSD, TIFF, BMP, IFF, JP2, JPX, JB2, JPC, XBM or WBMP image file and returns the dimensions of the image as well as the file type and one can be used for The height/width text string in the IMG tag in a normal HTML file. And starting from PHP 4.0.5, the parameter is also supported to be a url. For example:

Copy code The code is as follows:
print_r(getimagesize('http://www.google.com.hk/images/srpr/logo4w .png'));

The output result is:
Copy code The code is as follows:
Array
(
[0] => 550
[1] => 190
[2] => 3
[3] => width="550" height="190"
[bits] => 8
[mime] => image/png
)

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/762613.htmlTechArticleIf you still want to obtain the size information of the flash file by parsing the header information of the swf file, it is really a bit wrong. Far away. Because starting from PHP 4, the getimagesize function has been built-in to do this. Its...
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