#37643 [Bgs]: GetImageSize function can not determine size of Compressed Flash files (CWS)
| From: | vdv at bitrixsoft dot com | Date: | Thu, 01 Jun 2006 12:52:29 +0000 |
| Subject: | #37643 [Bgs]: GetImageSize function can not determine size of Compressed Flash files (CWS) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-97923@lists.php.net to get a copy of this message | ||
ID: 37643
User updated by: vdv at bitrixsoft dot com
Reported By: vdv at bitrixsoft dot com
Status: Bogus
-Bug Type: *General Issues
+Bug Type: Feature/Change Request
Operating System: Any
PHP Version: 5.1.4
New Comment:
Ok. Changed to the Feature request.
Really see many requests from our customers.
Do you have any plans on fixing the issue in the nearest time?
Previous Comments:
------------------------------------------------------------------------
[2006-05-30 13:43:11] derick@php.net
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.
------------------------------------------------------------------------
[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