I've been tagged [This link opens in a new window]

Getting the width and height of a swf in ColdFusion

Seeing as ColdFusion and Flash are owned by the same corporation (Adobe) you would assume there would be some kind of flash integration into ColdFusion (ColdFusion 8 especially), well you would be wrong, cos theres none... well none that allows you to get a width and height of a .swf anyway.

Well fortunately, the guys over at Alagad have created a free cfc that allows you to read the important information from a .swf file. The most usful part of this is the ability to get the width and height of a .swf, and it's all done in a couple of lines of code:

<cfset flashInspector=CreateObject("Component",
"path.to.flashinspector").init(expandPath("flash.swf"))>
<cfset width=flashInspector.getMaxX()>
<cfset height=flashInspector.getMaxY()>

That's it, now you have the width and height of the supplied flash.swf file.

You can download the .cfc here, and also make a donation to help the cause!

  • Del.icio.us [This link opens in a new window]
  • Digg [This link opens in a new window]
  • Technorati [This link opens in a new window]
  • Reddit [This link opens in a new window]
  • Stumble Upon [This link opens in a new window]
  • Furl [This link opens in a new window]