[AC-519] Encoding image from camera to base64 string not working - ASL MESSAGE SIZE EXCEEDED MAXIMIMUM SIZE
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Resolved |
| Resolution | Cannot Reproduce |
| Resolution Date | 2015-12-03T06:38:20.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Titanium SDK & CLI |
| Labels | n/a |
| Reporter | Marian Kucharcik |
| Assignee | Shak Hossain |
| Created | 2015-11-30T12:25:27.000+0000 |
| Updated | 2015-12-03T06:38:20.000+0000 |
Description
Hi guys,
I successfully used this code to send image via JSON to server:
Ti.Utils.base64encode(event.media).toString()
event.media is image taken from camera or from gallery.
When I use this code now, it gives me a warning:
*** ASL MESSAGE SIZE (8132517 bytes) EXCEEDED MAXIMIMUM SIZE (2048000 bytes) ***
I can't get base64 string from image, so I can't send it.
If I try to alert that "string", it freezes whole app for a while and then shows empty alert window, which is very high(but it's empty).
Can you please help me?
Thank you.
Hello [~max87], The issue might be in your server side. You can follow this [post](https://community.websense.com/forums/p/35378/57619.aspx). Also, can you update to the latest SDK 5.1.1.GA and check? Also here are some links on base64 encoding issues. [Link1](https://developer.appcelerator.com/question/136810/cant-encode-imageview-to-base64-string) [Link2](https://developer.appcelerator.com/question/125518/encode-image-to-base64) Thanks.
Hi Sharif, thank you for your answer. I discovered, that image from camera/photogallery might be too big, so I created method that checks that image for size and if needed, it resize it to half width and height. This method then call self recursively and checks again, so finally, I get smaller image with proper size, but I can convert it to base64 and send it to server. Thank you