If you develop for Flash Lite 1.1, FlashLite Writer Toolkit is a very good and very simple solution for converting JPG files to SWFS on the fly.

For the last year I have been using Flash Writer Toolkit from bronson beta. I’ve been very pleased with it. It is super easy to use, it only has three small PHP files and has no dependencies on any other libraries. I have however been a bit tight lipped on it though, not because I didn’t want to tell people how cool it was but because it had one serious flaw.

The PHP file is old. If was made in the days of solving the problem in Flash 5. Because of that, you have to make a small modification to let the file even open in Flash Lite (based on the flash 4 player). Beyond that though was the more serious issue that It was built for an older version of PHP. Methods like fopen work differently now and the tool simply didn’t work in the newer versions of PHP.

My skills at PHP are very much in the dabbling area and debugging an application that is reconstructing a binary file was really not going to be an afternoon project for me. Laziness won out and I just installed an old version of PHP. Finally I’ve gotten around to tweaking the original source and the example to be particularly useful for Flash Lite.

It turns out that there really wasn’t much to change, but since posting a revised copy is much easier than explaining what to change over and over, here you go. ;)

To use the files, just drop all three in a directory on a webserver running PHP. You should only need to modify the jpg2swf.php file. You just supply a URL and you are off to the races. When laziness is beaten back once more, I really need to add support for the GD libraries to resize images, auto rotate them and do all the other fun stuff that GD 2 does.

Thanks to Henri who mercifully ended my confusion on several PHP things.