ID:               17272
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-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] [EMAIL PROTECTED]

This is enough info.. I'll see if I can hack it in.

Derick

------------------------------------------------------------------------

[2002-05-23 08:40:40] [EMAIL PROTECTED]

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] [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.

------------------------------------------------------------------------

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

Reply via email to