Converting Canvas element to Image and storing in database

后端 未结 1 332
滥情空心
滥情空心 2021-01-01 03:10

I want to store the Image into my Server side Database. Once the user draw using canvas and hit a Submit button , Canvas Element should be converted to im

相关标签:
1条回答
  • 2021-01-01 04:01

    Use Canvas.toDataURL() which will return a string with a base64 encoded PNG. You can then store it as a normal text or decode and save as a file. To put it back on canvas you simply pass this string as a source for Canvas.draw(source, 0, 0) method

    Fiddle for you: http://jsfiddle.net/9a7Xd/

    0 讨论(0)
提交回复
热议问题