-1
我想要在數據庫中保存簽名,但圖像base64字符串非常長(約15000個字符)將base64轉換爲base30的任何簡單解決方案?將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);
}
});
base30字符串會更長.. – Beep
base30表示會比base64長嗎? –
在這個例子中http://willowsystems.github.io/jSignature/#/demo/,在簽名並選擇base30字符串之後馬上就是base64 – paris0000