I've been stuck for so many days on this. I'm seeing a lot of the same problem like this, but some of the codes from them won't work on me. To be precise, I'm not using php 5 nor 7. But this is what I've got so far.
(Assuming there are drawings in this canvas) my html:
<canvas id="displaycanvas" height="400px" width="700px" style="position:absolute; background-image:url('images/canvas_pattern.jpg');background-attachment:fixed;"> </canvas>
<canvas id="display_text" height="400px" width="700px" style="position:absolute;" > </canvas>
<input type="button" name="btn" id="submitBtn" value="display" class="btn btn-primary" />
And I successfully converted my canvas to image and displays it!
$(function () {
$("#submitBtn").bind("click", function () {
var display01 = $('#displaycanvas')[0].toDataURL();
$("#show_canvas").attr("src", display01);
$("#show_canvas").show();
});
});
display part of the image: (works fine)
<img id="show_canvas" name="show_canvas" height="400px" width="700px"/>
now after displaying, I have a button "save" which means to store the image or canvas in my database and it executes at the "submit.php".
but I'm stuck on how am I going to store it in my database... right now I only have a primary key on my "Image_table", not sure what are the right attributes to add.
Thank you in advance!!