For those looking for just getting size of a .swf file :
<?
// bytes_to_signed_int(data,offset,length)
function b2i($d,$o,$l) {
$s=(ord($d[$o/8])>>(7-$o%8))&1; $r=0;
for ($i=$o+1;$i<$o+$l;$i++) {
$b=(ord($d[$i/8])>>(7-$i%8))&1;
$r=($r<<1)+($s?!$b:$b);
}
if ($s) { $r++; $r=-$r; }
return $r;
}
// flash9 or <9 but uncompressed
$f="myfile.swf";
// get only 20 first bytes
$d=file_get_contents($f,0,null,0,20);
echo "Version of Flash : ".ord($d[3])."<br>";
$s=unpack("V",substr($d,4,4)); echo "FileSize : ".$s[1]." bytes<br>";
// here is the decompression, fix this for flash <9
if (substr($d,0,3)=="CWS") $d=substr($d,0,8).gzinflate(substr($d,8));
$nb=ord($d[8])>>3; // bytes needed
$xmin=b2i($d,8*8+5,$nb);
$xmax=b2i($d,8*8+5+$nb,$nb);
$ymin=b2i($d,8*8+5+2*$nb,$nb);
$ymax=b2i($d,8*8+5+3*$nb,$nb);
// width=xmax-xmin, height=ymax-ymin, twips->pixels = /20
echo "width=".(($xmax-$xmin)/20)."<br>";
echo "height=".(($ymax-$ymin)/20)."<br>";
?>