via http://www.quasimondo.com/

Did you have the problem before that you wanted to load some file formats into your Flash site but loadMovie does not accept them? Something like PNGs, GIFs or progressive JPEGs? Do you want to load images or SWFs from a different domain but the security sandbox is in your way? For these purposes I have written swfImageProxy, a PHP script that automatically converts file formats that are usually indigestible for Flash into something that it can display. On top of that it acts a proxy and is able to download images from other domains.

Here is a simple Flash demo that allows you to enter the URL of an image and swfImageProxy will try to retrieve and convert it.

If you want to use the full functionality of the script your server will have to fulfill certain prerequisites:

  • For basic functionality you will at least need PHP with GD support.
  • If you want the conversion of progressive JPEGs to baseline optimized JPEGs to be lossless the script needs access to the jpegtran utility.
  • If you want to be able to read GIFs the minimum required version of GD is 2.0.28 which currently happens to be the latest version
  • If you want to preserve the transparency of PNGs and GIFs they have to be packaged as SWFs. For this purpose the png2swf utility from the excellent swftools package by Rainer B? and Matthias Kramm has to be installed

You can download swfImageProxy here. Currently I have only tested this on Linux - if you are able to run this on Windows I’m happy to hear about it. I have tried to make this as secure as possible, but of course you use this on your own risk. It also looks like the png2swf tool does not fully support every format of PNGs yet.