Here is an example of a compressed and condensed SWF file I wrote:
Not added to determine whether the SWF file has been compressed, into the need can be based on the first byte of a file is F or C to determine
Compress swf File://File name
$filename = "test.swf";
Open File
$rs = fopen ($filename, "R");
Reading data from a file
$str = Fread ($rs, FileSize ($filename));
Set SWF header File
$head = substr ($str, 1,8);
$head = "C". $head;
Get SWF file contents
$body = substr ($STR, 8);
Compress the contents of a file using the highest compression level 9
$body = Gzcompress ($body, 9);
Merging file headers and contents
$str = $head. $body;
Close the Read file stream
Fclose ($RS);
Create a new file
$ws = fopen ("create.swf", "w");
Write a file
Fwrite ($ws, $STR);
Close file leave
Fclose ($WS);
------http://soft.knowsky.com/------------------------------------------------------------------------------ ----------------
?>
To extract the SWF file:
//----------------------------------------------------------------------------------------------------
Filename
$filename = "test.swf";
Open File
$rs = fopen ($filename, "R");
Reading data from a file
$str = Fread ($rs, FileSize ($filename));
Set SWF header File
$head = substr ($str, 1,8);
$head = "F". $head;
Get SWF file contents
$body = substr ($STR, 8);
Unzip the contents of a file
$body = gzuncompress ($body);
Merging file headers and contents
$str = $head. $body;
Close the Read file stream
Fclose ($RS);
Create a new file
$ws = fopen ("create.swf", "w");
Write a file
Fwrite ($ws, $STR);
Close file leave
Fclose ($WS);
//----------------------------------------------------------------------------------------------------
?>
http://www.bkjia.com/PHPjc/508903.html www.bkjia.com true http://www.bkjia.com/PHPjc/508903.html techarticle Here is an example of a compressed and a compressed SWF file I wrote://Not added to determine whether the SWF file has been compressed, the need to be able to according to the first byte of the file is F or C to determine the compressed SWF text ...