我想在数据库中保存签名但是图像base64字符串很长(大约15000个字符)任何将base64转换为base30的简单解决方案?
以下是我的示例,我尝试添加signaturePad.toDataURL("image/jSignature;base30");
但不能正常工作。
var wrapper = document.getElementById("signature-pad"),
clearButton = wrapper.querySelector("[data-action=clear]"),
saveButton = wrapper.querySelector("[data-action=save]"),
canvas = wrapper.querySelector("canvas"),
signaturePad;
function resizeCanvas() {
var ratio = Math.max(window.devicePixelRatio || 1, 1);
canvas.width = canvas.offsetWidth * ratio;
canvas.height = canvas.offsetHeight * ratio;
canvas.getContext("2d").scale(ratio, ratio);
}
window.onresize = resizeCanvas;
resizeCanvas();
alert(canvas);
signaturePad = new SignaturePad(canvas);
//Here get base64 string
saveButton.addEventListener("click", function (event) {
document.getElementById("signatureDiv").value = signaturePad.toDataURL();
saveToDB(signaturePad.toDataURL);
}
});