php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29611 GetImageSize returns false for swf files.
Submitted: 2004-08-11 13:04 UTC Modified: 2004-08-11 14:33 UTC
From: cstdenis at hotmail dot com Assigned:
Status: Closed Package: GetImageSize related
PHP Version: 5.0.0 OS: FreeBSD 4.9
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cstdenis at hotmail dot com
New email:
PHP Version: OS:

 

 [2004-08-11 13:04 UTC] cstdenis at hotmail dot com
Description:
------------
GetImageSize returns false for swf files. This worked fine when I was using php4.3.8, but after upgrading to 5 it no longer returns the size, just false.

Perhaps an additional library is needed for this to work with flash, but nothing like that is said in the documentation.

I am using Apache 2

I have a reasonably normal php.ini, register globals is on, rest is more or less standard.

Configure Command =>  './configure' '--enable-versioning' '--enable-memory-limit' '--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local' '--enable-spl' '--with-regex=php' '--with-apxs2=/usr/local/sbin/apxs' '--disable-ipv6' '--prefix=/usr/local' 'i386-portbld-freebsd4.9'



As is the setup of the new php FreeBSD ports, most of my modules are dynamic (loaded .so files) insted of static compiled. Here is a list of them

extension=/usr/local/lib/php/20040412/bz2.so
extension=/usr/local/lib/php/20040412/ctype.so
extension=/usr/local/lib/php/20040412/dio.so
extension=/usr/local/lib/php/20040412/dom.so
extension=/usr/local/lib/php/20040412/ftp.so
extension=/usr/local/lib/php/20040412/gd.so
extension=/usr/local/lib/php/20040412/iconv.so
extension=/usr/local/lib/php/20040412/imagick.so
extension=/usr/local/lib/php/20040412/imap.so
extension=/usr/local/lib/php/20040412/mbstring.so
extension=/usr/local/lib/php/20040412/mcrypt.so
extension=/usr/local/lib/php/20040412/mhash.so
extension=/usr/local/lib/php/20040412/mysql.so
extension=/usr/local/lib/php/20040412/openssl.so
extension=/usr/local/lib/php/20040412/pcre.so
extension=/usr/local/lib/php/20040412/posix.so
extension=/usr/local/lib/php/20040412/session.so
extension=/usr/local/lib/php/20040412/simplexml.so
extension=/usr/local/lib/php/20040412/sockets.so
extension=/usr/local/lib/php/20040412/sqlite.so
extension=/usr/local/lib/php/20040412/tokenizer.so
extension=/usr/local/lib/php/20040412/xml.so
extension=/usr/local/lib/php/20040412/zip.so
extension=/usr/local/lib/php/20040412/zlib.so

Reproduce code:
---------------
var_dump(GetImageSize("SomeFlashFile.swf"));
//will produce false in php5, returns normal data in php4.3.8

var_dump(GetImageSize("SomePicture.jpg"));
//Works fine in both versions

Expected result:
----------------
see inline comments

Actual result:
--------------
see inline comments

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-11 13:07 UTC] derick@php.net
Please provide a link to the .swf file in question.
 [2004-08-11 13:17 UTC] cstdenis at hotmail dot com
As far as I can tell, any swf file. Here are 2 that are known to be affected.

http://www.fanart-central.net/images/a/anime_pat/hottest_duck_in_town.swf
http://www.fanart-central.net/images/t/TX2/Untitled_1_Scene_2.swf

The first one I know worked before I upgraded to php5, becasue I was using it for testing a few days before.
 [2004-08-11 13:22 UTC] derick@php.net
This one works for me:
derick@kossu:~$ php -r 'var_dump(getImageSize("hottest_duck_in_town.swf"));'
array(5) {
  [0]=>
  int(550)
  [1]=>
  int(400)
  [2]=>
  int(13)
  [3]=>
  string(24) "width="550" height="400""
  ["mime"]=>
  string(29) "application/x-shockwave-flash"
}
derick@kossu:~$ php -v
PHP 5.0.1-dev (cli) (built: Aug 11 2004 08:20:08) (DEBUG)
Copyright (c) 1997-2004 The PHP Group

But it is a compressed shockwave flash movie, so I think it's that you're missing zlib/gzip support in your PHP version. Do you have a link to a phpinfo() output?
 [2004-08-11 13:24 UTC] derick@php.net
As far as I can see in the source zlib/gzip may NOT be compiled shared in order for this to work either:

#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
        case IMAGE_FILETYPE_SWC:
            result = php_handle_swc(stream TSRMLS_CC);
            break;
#endif

I will change the code to issue a notice instead of just returning false.

Derick
 [2004-08-11 13:37 UTC] cstdenis at hotmail dot com
I compiled in zlib and it works now. A notice should help prevent other people from running into this, but I'll add a User Contributed Note about it to the doc too.

Thanks for the help.
 [2004-08-11 14:33 UTC] derick@php.net
I added this notice for 5.0.1+ and 5.1.x
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 22 20:01:31 2024 UTC