I\'m working on a generative art project where I would like to allow users to save the resulting images from an algorithm. The general idea is:
Here is an example of how to achieve what you need:
Convert canvas image to URL format (base64)
var dataURL = canvas.toDataURL();
Send it to your server via Ajax
$.ajax({
type: "POST",
url: "script.php",
data: {
imgBase64: dataURL
}
}).done(function(o) {
console.log('saved');
// If you want the file to be visible in the browser
// - please modify the callback in javascript. All you
// need is to return the url to the file, you just saved
// and than put the image in your browser.
});