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
BitmapExporter can theoretically save bitmaps up to Flash's maximum allowed size of 2880x2880 though it will take quite some time to save huge bitmaps like this. If you are planning to work with these sizes I recommend you to go for an AS3 solution since Flash 9 has much easier and faster possibilities to save Bitmaps.
[Important Notice] due to a non-backward compatible change by Adobe in Flash Player 10 security model the default behavior of BitmapExporter - popping up a file browser after the saving has completed - is not possible anymore and will create a security error. I currently do not have time to change the class to accomodate for that problem, but fortunately it is not that difficult to work around it. Follow the instructions in this blogpost.
You can download BitmapExporter 2.2 here. The license conditions are:
The use of the BitmapExporter package is free for all non-commercial work if PROPER ATTRIBUTION is given. "non-commercial" means that you do not get paid for this work or you do not intend to sell it. "proper attribution" is a credit line somewhere VISIBLE along your piece of work which reads like this:
"[Insert your work title here] uses BitmapExporter by Mario Klingemann"
If you cannot comply to this rule please contact me for a special permission.
The use of the BitmapExporter package is NOT AUTOMATICALLY FREE for all commercial works or services. If you are able to show the follwing attribution line along with the work:
"[Insert your product title here] uses BitmapExporter by Mario Klingemann"
there is no license fee though it would be better for your karma if you shared a tiny amount of the money you get paid for this job with me.
If you do not want to or are not able to show the credit line the one time license fee is EURO €250.- per site/product.
Please contact me for special agency/studio conditions regarding licensing for multiple sites/products/clients.Posted at May 28, 2007 02:37 PM | Further reading