How to save an HTML5 Canvas as an image on a server?

后端 未结 8 2325
走了就别回头了
走了就别回头了 2020-11-21 23:50

I\'m working on a generative art project where I would like to allow users to save the resulting images from an algorithm. The general idea is:

  • Create an image
8条回答
  •  滥情空心
    2020-11-22 00:31

    If you want to save data that is derived from a Javascript canvas.toDataURL() function, you have to convert blanks into plusses. If you do not do that, the decoded data is corrupted:

    
    

    http://php.net/manual/ro/function.base64-decode.php

提交回复
热议问题