ID: 17272 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Suspended Bug Type: Feature/Change Request Operating System: N/A PHP Version: 4.1.2 New Comment:
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. Previous Comments: ------------------------------------------------------------------------ [2002-05-17 13:27:46] [EMAIL PROTECTED] 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] [EMAIL PROTECTED] 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] [EMAIL PROTECTED] The problem is with the getimagesize() function and its detection routines which don't detect Flash 6/MX content. ------------------------------------------------------------------------ [2002-05-16 12:00:44] [EMAIL PROTECTED] Flash file size detection seems to not work for Flash files published in the new Flash "MX" (version 6). When published to version 5 or lower, it works. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17272&edit=1