ID: 37643 Updated by: [EMAIL PROTECTED] Reported By: vdv at bitrixsoft dot com -Status: Open +Status: Bogus Bug Type: *General Issues Operating System: Any PHP Version: 5.1.4 New Comment:
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Thank you for your interest in PHP. Previous Comments: ------------------------------------------------------------------------ [2006-05-30 13:40:02] vdv at bitrixsoft dot com Description: ------------ GetImageSize function can not determine size of Compressed Flash files (CWS). Same as here: http://bugs.php.net/bug.php?id=36542&edit=2 http://bugs.php.net/bug.php?id=34338&edit=2 This function still can not determine size and dimensions of the compressed Flash movies untill the Zlib library is compiled statically. But it can be quite easily done with manual decompressing file and reading its header. So it need to be fixed in general case because of the Flash format popularity. Reproduce code: --------------- It can be reproduced with simple script that loads compressed Flash files and matches their sizes. Expected result: ---------------- Here is quick solution based on some tips from your bug descriptions. function swf_decompress($buffer) { if (function_exists('gzuncompress') && substr($buffer, 0, 3) == "CWS" && ord(substr($buffer, 3, 1)) >= 6) { $output = 'F'; $output .= substr ($buffer, 1, 7); $output .= gzuncompress (substr ($buffer, 8)); return ($output); } else return ($buffer); } $tmpFilePath=$arFile."tmp"; $out=fopen($tmpFilePath, "w"); $in=fopen($arFile, "r"); fwrite($out,swf_decompress(fread($in, filesize($arFile)))); fclose($in); fclose($out); $arImageSize = getimagesize($tmpFilePath); unlink($tmpFilePath); Actual result: -------------- Function returns false or error instead of actual size. Interesting that this bug was added here in the year 2002 and it still can be reproduced easily. Do you have some special version that can not be downloaded by others? :) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37643&edit=1