I'm trying to save my canvas as an image to my server but it is not working.
javascript
var data = canvas.toDataURL();
var picture = document.getElementById("my-picture");
PHP
$canvas = base64_decode(str_replace('data:image/png;base64,', '' , $value['picture']));
file_put_contents('my_custom_path/my_custom_filename.png', $canvas);
this code was given to me but I am not sure how to implement the php part.