Screenshot of a div with html2canvas. Sent to php, saved: Corrupted image

前端 未结 1 1420
醉话见心
醉话见心 2021-01-13 15:08

I generate the canvas and pass it to php so:

$(\'body\').on(\'click\',\'#save_image\',function(){
                html2canvas($(\'.myImage\'), {
                     


        
相关标签:
1条回答
  • 2021-01-13 15:48

    You should probably base64_decode() the data URL. It even says it in the URL itself: data:image/png;base64,...

    $decoded = base64_decode(str_replace('data:image/png;base64,', '', $image));
    
    0 讨论(0)
提交回复
热议问题