Bug #17272 Updated: Failure to read Flash MX file size
| From: | derick@php.net | Date: | Thu, 23 May 2002 21:46:13 +0000 |
| Subject: | Bug #17272 Updated: Failure to read Flash MX file size | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-8358@lists.php.net to get a copy of this message | ||
ID: 17272
Updated by: derick@php.net
Reported By: zzz123123123@hotmail.com
-Status: Assigned
+Status: Closed
Bug Type: Feature/Change Request
Operating System: N/A
PHP Version: 4.1.2
Assigned To: derick
New Comment:
Added code to handle compressed SWF files to CVS, please try the latest
snapshot (in a couple of hours from now) from http://snaps.php.net/
Derick
Previous Comments:
------------------------------------------------------------------------
[2002-05-23 08:43:59] derick@php.net
This is enough info.. I'll see if I can hack it in.
Derick
------------------------------------------------------------------------
[2002-05-23 08:40:40] niels@creatype.nl
I ran into the same problem when Flash 6 came out, so I tried to fix
the problem with PHP code. The SWC format is a regular SWF file, but
with a portion of the file compressed with zlib. Unfortunately the
width and height of the SWC file is located inside the compressed
portion.
SWF:
[HEADER - 3 bytes] 'FWS'
[VERSION - 1 byte] In which version was this file created
[SIZE - 4 bytes] size of file
[TAGS] All tags
SWC:
[HEADER - 3 bytes] 'CWS'
[VERSION - 1 byte] In which version was this file created
[SIZE - 4 bytes] size of uncompressed file
[ZLIBSTREAM] Zlib compressed stream of all tags
To decompress the file you need to copy the first 8 bytes of the SWC
file to a buffer and change to first byte of the buffer to 'C'. Then
you need to decompress the remaining bytes of the SWC file and append
it to the buffer.
The following PHP function uses this method to decompress the file:
function phpAds_SWFDecompress($buffer)
{
if (function_exists('gzuncompress') &&
substr($buffer, 0, 3) == swf_tag_compressed &&
ord(substr($buffer, 3, 1)) >= 6)
{
$output = 'F';
$output .= substr ($buffer, 1, 7);
$output .= gzuncompress (substr ($buffer, 8));
return ($output);
}
else
return ($buffer);
}
If you are only interested in retrieving the dimensions of the SWC file
it can be even easier. Just strip the first 8 bytes of the SWC file and
decompress the remaining bytes. The tags for the width and height
should be first two tags inside the decompressed stream.
------------------------------------------------------------------------
[2002-05-17 13:27:46] derick@php.net
I'm suspending this until somebody can show me some documentation on
the new fileformat. Apperently there are two Flash 6 formats, the SWF
one (which works fine and is the same as Flash 5) and the SWC one,
which is some compressed format.
Derick
------------------------------------------------------------------------
[2002-05-16 13:22:22] derick@php.net
Not really a bug, as it was not written for this :)
Anyway, if you could mail me empty flash movies with the following
size, I'll see what I can do:
255x127
640x480
400x256
(and perhaps some more)
Derick
------------------------------------------------------------------------
[2002-05-16 12:22:48] reywob@f2s.com
The problem is with the getimagesize() function and its detection
routines which don't detect Flash 6/MX content.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/17272
--
Edit this bug report at http://bugs.php.net/?id=17272&edit=1