php解析flash文件(.swf文件)获取其长度和宽度
以前介绍过php如何解析音频、视频(mp3、mp4)和php如何处理图片,今天在介绍一个php处理flash(swf)的类swfheader.class.php
简单举例:
//引入该文件 <div id="page" class="hfeed site"> <div id="content" class="site-content"> <div class="container"><section id="primary" class="content-area"><article id="post-21" class="post-21 post type-post status-publish format-standard hentry category-phpclass tag-flash tag-phpclass"> <div class="entry-content"> Require(‘swfheader.class.php’); //创建一个类的实例 $swf = new swfheader(false); //false 参数意思是禁用debug模式,若要开启请赋值true。 //打开你要探测的swf文件 $path = ‘../../’; $swf->loadswf($path.”myflash.swf"); //获取参数 $width = $swf->width;//宽度,单位像素 $height=$swf->height;//高度,单位像素 </div> </article></section></div> </div> </div>
所有属性:
swfheader Object ( [debug] => [fname] => main_flash8.swf [magic] => CWS [compressed] => 1 [version] => 8 [size] => 2058423 [width] => 980 [height] => 750 [valid] => 1 [fps] => Array ( [0] => 0 [1] => 30 ) [frames] => 107 )
下载swfheader.class.php