0
votes

Flash CS6 (AS3):

This is what I am trying to accomplish...

Convert bitmapdata -> bytearray -> encode using JPEGencoder (PNGencoder, or any other alternatives) -> base64 string. Once i get hold of this base64 string, I will be able to use my string obfuscation algorithm, and send that string to php.

Now the reverse (decryption) to get back my original image. Load the obfuscated string from php into flash -> deobfuscation algorithm -> decodebase64toBytearray -> bitmapdata

The challenge for me rite now is in converting base64 to bytearray, and then to bitmapdata.

Can someone guide me on how to get back the bitmap image from base64 string?

1
IMHO better way is to encrypt/descrypt images (or any binary data) and send directly without base64 encoding from Flash to PHP and vice versa. Anyway you can use as3Crypto library for Base64 encoding, or some encryption. It's not the sane you asked, but sure this will give you directiuons. Using AES-128 encryption might be good solution: sarakhman-lab.blogspot.com/2012/02/encryption-as3php.html - gMirian
I am building an application that lets users encrypt the photos they upload. So I don't want the raw data of images to be stored in the server, since its easy to get back the photos without string obfuscation. So I am thinking about being able to convert bitmapdata to base64, and then viceversa. - Jerry-bliss

1 Answers

0
votes
var pBytes:ByteArray = Base64.decodeToByteArray(pString);

var pBitmapData:BitmapData = PNGEncoder2.decode(pBytes);