c# - Passing img element as return value -
i have html5 wp8 app under development. in html/js side collect data (text , images) i'm supposed send on c# emailed forward. have function in javascript
function toemail() { var datatosend = getnextentry(); return datatosend; } and call from c# with
string tobeemailed; tobeemailed = (string)browser.invokescript("toemail"); and works fine. should same image stored in img.src. how can that? datatype should cast return value etc.
use can image base64 string.
for example:
function img2base64(img) { var canvas = document.createelement("canvas"); canvas.width = img.width; canvas.height = img.height; var context = canvas.getcontext("2d"); context.drawimage(img, 0, 0, img.width, img.height); return canvas.todataurl("image/jpeg")); }
Comments
Post a Comment