Decoding a canvas todataURL

前端 未结 4 1203
深忆病人
深忆病人 2020-12-07 03:06

I\'m having difficulty using data created with canvas\'s todataurl() method. Currently my code sends the resulting data to my php server which uses the file_put_contents() m

4条回答
  •  自闭症患者
    2020-12-07 03:19

    Another important note is you have to convert blanks into plusses. If you do not do that, the decoded data is corrupted:

    $encodedData = str_replace(' ','+',$encodedData);
    $decocedData = base64_decode($encodedData);
    

    You can read more at http://www.php.net/manual/en/function.base64-decode.php

提交回复
热议问题