bla2eOD
bla2eOD

Reputation: 77

How to convert canvas to image on sever

scheme:user draws in canvas, canvas converted to image (png or jpeg), converted file is saved in specific dir on server, after drawing canvas user clicks button, all i could do is:

  function to_image(){
            var canvas = document.getElementById("canvas");
            var data = canvas.toDataURL('image/png');}

how i can perform this task? (is there any way to do it without AJAX or not?)

Upvotes: 2

Views: 483

Answers (1)

Daniel Mensing
Daniel Mensing

Reputation: 964

You'll have to submit it to the server using a form and/or ajax. JavaScript is run at clientside, so its not able to interfere with the server directly.

Edit: You could maybe find something usefull here, if you need more info on how to do this: Uploading 'canvas' image data to the server

Upvotes: 1

Related Questions