Fabric.js canvas.toDataURL() sent to PHP by Ajax

后端 未结 5 863
青春惊慌失措
青春惊慌失措 2021-02-06 14:44

I have a problem here when I need create a image with transparent background. I still don´t know if the problem is with fabricjs or with php. Everything works fine when I sent a

5条回答
  •  旧巷少年郎
    2021-02-06 15:27

    Why did you use GD for this? You can use file_put_contents for save png file from your canvas.

    // createImage.php

    $data = base64_decode($_POST["str"]);
    
    $urlUploadImages = "../uploads/img/test.png";
    file_put_contents($urlUploadImages, $data);
    

提交回复
热议问题