Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
Posts: 18
Registered: ‎12-08-2011
My Device: Bold 9700
My Carrier: Telus
Accepted Solution

Help with canvas.toDataURL

Hello, I'm having trouble sending the output of canvas.toDataURL to a web service.

 

var canvas = document.getElementById('signature-canvas');

var ctx = canvas.getContext("2d");

var image = canvas.toDataURL();

var image_b64str = image.replace(/^data:image\/\w+;base64,/, "");

 

When I try to send image_b64str to my web service call it is giving me error 500. Now, before you tell me it's a problem with the web service itself, please note that if I hard code a base 64 image like so:

 

var image_b64str = "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";

 

The web service accepts it fine and does what it is supposed to.

 

Any ideas or advice?

Contributor
Posts: 18
Registered: ‎12-08-2011
My Device: Bold 9700
My Carrier: Telus

Re: Help with canvas.toDataURL

Nevermind, turns out once again it is that blasted Ripple emulator.

Contributor
Posts: 19
Registered: ‎12-26-2010
My Device: 9800

Re: Help with canvas.toDataURL

Hey, I am having similar trouble. However my situation is a bit different as i have to send mutliple base64 encoded images. One image captured from the camera is sent fine. However the app is not able to send mulitple images using Blackberry webworks. Seems like a MAX cap on the HTTPXMLRequest is being placed of somethings like 128KB. I used my app on WIFI by the way. Any hints you can give. ??