Home > php教程 > php手册 > body text

php中使用getimagesize获取图片、flash等文件的尺寸信息实例

WBOY
Release: 2016-06-06 20:23:00
Original
1196 people have browsed it

这篇文章主要介绍了php中使用getimagesize获取图片、flash等文件的尺寸信息实例,需要的朋友可以参考下

如果你还想着通过解析swf文件头信息来获取flash文件的尺寸信息,那真的有点走远了。因为从PHP 4开始已经内置getimagesize函数来做这个事。其功能测定任何 GIF,JPG,,PNG,SWF,SWC,PSD,TIFF,BMP,IFF,JP2,JPX,JB2,JPC,XBM 或 WBMP 图像文件的大小并返回图像的尺寸以及文件类型和一个可以用于普通 HTML 文件中 IMG 标记中的 height/width 文本字符串。而且从PHP 4.0.5起还支持参数是一个url。例如:

复制代码 代码如下:

print_r(getimagesize('http://www.google.com.hk/images/srpr/logo4w.png'));


输出的结果为:

复制代码 代码如下:

Array
(
    [0] => 550
    [1] => 190
    [2] => 3
    [3] =>
    [bits] => 8
    [mime] => image/png
)


 
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template