I am having problems with the following snippet:
var o = $("#inserted_motive").find("span");
$.contains(document.documentElement, o[0]) ? b.fillText(m, i, h) : b.drawImage(d, i, h, e, f);
var p = a.toDataURL("image/png");
window.open(p)
}), $(function () {
$("#tabs").tabs()
});
The following error will appear:
Uncaught TypeMismatchError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': the first argument provided is either a null or invalid HTMLImageElement, HTMLCanvasElement, or HTMLVideoElement.
also answer the question;
$("#creator").click(function () {
var a = document.getElementById("final_image"),
b = a.getContext("2d"),
c = document.getElementById("shirt_main_canvas"),
d = document.getElementById("inserted_image");
b.drawImage(c, 0, 0);
var e = $("#inserted_image").width(),
f = $("#inserted_image").height(),
g = $("#inserted_motive").position(),
h = g.top,
i = g.left,
j = $("#inserted_motive span").css("font-size"),
k = $("#inserted_motive span").css("font-family"),
l = $("#inserted_motive span").css("color"),
m = $("#inserted_motive span").text(),
n = j + " " + k;
source
share