There’s an image gallery site, and the user can manipulate the images via javascript and HTML5 canvas. Is it possible to send back the manipulated image to the server for storing with PHP?
There’s an image gallery site, and the user can manipulate the images via javascript
Share
HERE you can find a complete article on the subject. But here’s the short version and source codes:
First you need to convert the canvas binary data as a base 64 encoded string to send it to server:
Send this with an ajax call:
Finally the PHP script save.php looks like this:
The PHP script parses the raw post data, converts from base 64 to binary, and saves to a file. For more information on Base 64 check out THIS Wikipedia article.