I have an HTML page that captures a user's signature as an SVG. I convert it on the page to a .png and put it into an image container.
How can I utilize this to go into a database? I know how to do it using: <input type="file" />
but I have no clue how I would pass an <img />
element to PHP.
This changes my SVG to a PNG
$("#save").click(function(){
var datapair = sigdiv.jSignature("getData", "svg");
var i = new Image();
i.src = "data:" + datapair[0] + "," + datapair[1];
$(i).appendTo($("#outputSvg"));
var canvas = document.getElementById("canvas");
canvg(canvas, datapair[1]);
var img = canvas.toDataURL("image/png");
$("#outputRaster").append("<img src='"+img+"'/>");
});
How do I take the <img />
tag I am generating in <div id='outputRaster'>
and pass it to my PHP? I know how to put it into the database, it's really just getting the image from my view layer to my PHP page, which is only being used for data access.
Any help or advice would be greatly appreciated!