Saving a base64 encoded image
My application receives images that are base64 encoded and wrapped in XML. While I have no problem choosing and sending a picture, the decoded picture will not render and is always larger than the original. This seems to be because Titanium re-encodes the data into some other format and does not recognize a binary string decoded from base64. Has anyone found a way around this?
A quick summary of methods I have tried (only on droid for now):
- Just writing the decoded string
- Using JSON to stringify and parse around the base 64
- Converting the string to an object and saving the file
- Attempting to create a tiblob for the string prior to saving
Code illustrating error and current workaround methods can be found at: http://pastie.org/1082461
A trace log of the code execution can be found at: http://pastie.org/1082455