5

As we know the function getimagesize() works very good for images and swf files.

But it doesn't support shockwave file (.dcr).

SO, how can I get the width and the height of such file..

assaqqaf
  • 1,575
  • 4
  • 21
  • 38
  • 1
    This is a very interesting question; I've been curious about the Shockwave file format myself, but I can't find any documentation about it. – icktoofay Apr 30 '11 at 07:16
  • What is the reason for needing the dimensions? Is it possible that there is another way to achieve what you need to do via other means? For example, if echoing to an HTML page you may be able to use the swStretchStyle attribute when specifying a standard height and width. More info here: http://x10hosting.com/forums/graphics-webdesign/53941-embedding-director-dcr-files.html – John Kramlich May 10 '11 at 07:17
  • @John: I don't know what the OP needed it for, but I was just interested how to get the width and height purely because it could offer some insight into the file format, which I'd really like to find some information about. – icktoofay May 10 '11 at 23:44
  • 1
    I have progressed with this a little: I found a DIR file with a known size and found where it is in the file. Unfortunately, it does not appear to be in the header, so it may not be so simple to find. I also was able to decompress data from within a DCR. The DCR file I was testing on, however, was much larger than the DIR file, so I cannot be so sure where the size is in the DCR. – icktoofay Dec 27 '12 at 02:12
  • 1
    It also looks like it uses a lot of FourCCs — some parts of it look *very similar* to the QuickTime file format. – icktoofay Dec 27 '12 at 02:18

2 Answers2

2

I am not Lingo/Director expert, but AFAIK you won't be able to do this from PHP.

.DCR file format is not open so you won't find file format specification for you to make your own parser and extract that info on your own.

However, there should be way to do this using director movie on client side.

Eg. You load external dcr file inside your own director movie (then you will be able to read width/height etc of loaded file). Your own director movie then updates some database with info on that specific loaded file so you can show width/height later on.

I've found this artice dating back to 2006 where this guy suggests the same thing: http://director-online.com/forums/read.php?1,20621,20621,quote=1

Good luck mate! :)

seven
  • 2,388
  • 26
  • 28
  • 1
    I'm going to award you the bounty simply because it's the only one that would work at all, but I really would have preferred an answer that reverse engineered the file format and found where to find the dimensions in it. – icktoofay May 14 '11 at 21:13
  • thank you icktoofay, if I ever came across file spec it is yours. – seven May 18 '11 at 14:36
-1

If you have a windows server, you could install IrfanView (free) and use it from the command line (yes, it's free and has a command line) to convert the swf to dcr. (Surely there is a similar tool for Linux).

Convert images on the command line with IfranView

To call OS command line from php, use shell_exec().

Then you could read the swf image size with php normally.

Hope this helps

Edgar Villegas Alvarado
  • 18,204
  • 2
  • 42
  • 61
  • 1
    I tried downloading IrfanView and all of its plugins, and it can't open a `.dcr` file I have. – icktoofay May 03 '11 at 01:51
  • From Edgar's description sounds like InfranView reads swf files and converts them to dcr raw image format, not the dcr shockwave format. – Angelo R. May 11 '11 at 17:42