How to save a html5 Canvas.toDataURl string as a png on a php backend -
after converting canvas image source using
canvas.todataurl("image/png");
and passing php file, how save .png image on server?
it's simple, if have allow-url-fopen
enabled. php supports data:
url scheme then, , automatically decodes base64 , urlencoding.
preg_match('#^data:[\w/]+(;[\w=]+)*,[\w+/=%]+$#', $data=$_post["datau"]) , copy($data, "output.png");
but extract part after ,
, manually base64_decode()
it.
Comments
Post a Comment