开发者

How I can save an image in Canvas Control to WebSQL?

开发者 https://www.devze.com 2023-04-05 20:42 出处:网络
How I can save an image in Canvas Control to WebSQL? My application is a jQuery Mobile Application. Here I found a clue for my answer

How I can save an image in Canvas Control to WebSQL? My application is a jQuery Mobile Application.

Here I found a clue for my answer

How save canvas as image?

var img = new WriteableBitmap(myCanvas, null);

But this img开发者_StackOverflow社区 how I can Save in my WebSql database? How do I convert this if I want to save it in an SQL SERVER table(Image DataType)?

I'll appreciate any help on this.


This image we can store in web sql in 'TEXT' datatype.

var canvas = document.getElementById('canvas');
MyImage = canvas.toDataURL('image/jpeg');

For previewing this, this 'MyImage' dataurl can set to any Image object 'src'.

var img = new Image();
img.src = MyImage;
0

精彩评论

暂无评论...
验证码 换一张
取 消