Tuesday, July 17, 2012

HTML Canvas toDataURL Not Sending Image To Server Correctly

So out of the following two lines, I was only using line #1. Only after adding line #1 did it start to work:


1. var canvasimg = b_canvas.toDataURL("image/png");


//this line is killer because it strips unnecessary headers from the image
2. var canvasimg=canvasimg.replace(/^data:image\/(png|jpg);base64,/, ""); 




I can't remember the source where I found this... so if this was you, then many many many many thanks.

No comments:

Post a Comment