我想使用Base64 + PhoneGap的2.5 HTML5的画布上的数据保存到服务器上。
I am trying to save html5 canvas data to server using base64 + phonegap 2.5.
平台:的Windows Phone 7和8,Android和iOS
platforms : windows phone 7 and 8 , Android and IOS.
基本需要调整图像大小是优化数据之前送过来的服务器。
Basic need for image resizing is to optimize data before send over server.
我有问题,Android平台的base64应对方法,如下:
I am having issue with android platform base64 response method which are as follows
问题
Android的4.2:我写这code c.toDataURL(为image / jpeg);
,但我得到这个数据:图像/ PNG;的base64
Android 2.3的:我无法检索的base64数据
Android 4.2 : I wrote this code c.toDataURL("image/jpeg");
but i got this data:image/png;base64
Android 2.3 : I am unable to retrieve base64 data
难道我做错什么?
canvas.toDataURL没有在旧的Android版本的支持。
canvas.toDataURL is not supported in old Android versions.
有对于一个JS的修复,但表现可能不是很好: https://$c$c.google.com/p/todataurl-png-js/
There's a js fix for that but performance might not be very good: https://code.google.com/p/todataurl-png-js/
点击此处查看更多信息: toDataURL不工作在Android浏览器
Check here for more info: toDataURL not working on android browsers
Android的4.2:我写这$ C C c.toDataURL(为image / jpeg)$;但我得到了这样的数据:图像/ PNG;的base64的Android 4.x的支持canvas.toDataURL;但是,它不支持JPEG格式(如果你问一个JPEG,它会返回一个PNG)。
Android 4.x supports canvas.toDataURL; however, it doesn't support jpeg format (if you ask for a jpeg, it will return a png).
详细信息: https://github.com/scottjehl/Device-Bugs/issues/33