Saving JPEGs or PNGs with Flash 8 Revisited
Even if this article might seem to be a bit anachronistic - believe it or not - there are many people out there who still have to code in Actionscript 2.0 and who publish for Flash Player 8. And it looks like there are more and more projects where there is a requirement to save users’ drawings, compositions or webcam snapshots to a server in order to add them to galleries, mail them to friends or simply download them.
Since the number of inquiries for commercial licenses of my BitmapExporter class has increased considerably I’ve decided to revise the code once more. The new version has been optimized in several places so the overall performance should be remarkably better. It also turned out that some encoding optimizations that I had used seemed to create compatibility issues with Asian operating systems. (Patrick - I should have listened to you earlier
…)
Here is a demo that allows you to play with different image types and the various settings that BitmapExporter offers:
The main features of BitmapExporter are:
- send any BitmapData object to a PHP server-side script with one line of code (currently alpha channels are ignored for performance reasons)
- if you only need PNG or BMP files a plain PHP installation is sufficient
- for JPEG support you will need a PHP installation with GD compiled in - this usually comes with the default package anyway
- option to automatically popup a download window for the user after the upload has been completed
- choice of 5 different encoding options depending on image content and size and desired encoding time / data size ratio
- highly optimized data encoding for maximum save speed
- automatic data chunking in order to avoid Flash timeout warning with big images (except for turboscan mode)
- adjustable time slice for background saving in order to play nicely with the application and not to hog resources








