download button

This commit is contained in:
Kyle
2018-10-21 18:21:22 -07:00
parent f65bb5accd
commit 8a1637901d

View File

@@ -152,6 +152,7 @@
<input type="checkbox" id="checkboxSecondWatermarkColor"> Second Watermark Color <select id="secondWatermarkColorSelection"></select></input> <input type="checkbox" id="checkboxSecondWatermarkColor"> Second Watermark Color <select id="secondWatermarkColorSelection"></select></input>
<br/> <br/>
</div> </div>
<div class="toggle" onclick="downloadCardImage()" id="downloadCardImage" href="" download="card.jpg">Download</div>
</div> </div>
</div> </div>
</div> </div>
@@ -866,5 +867,12 @@ function toggleVisibility(targetClass, self, selfClass, hiddenClass, shownClass)
function loadSetSymbol() { function loadSetSymbol() {
imgSetSymbol.src = "https://raw.githubusercontent.com/ImKyle4815/MTG-Set-Symbols/master/setSymbols/" + document.getElementById("setSymbolCode").value.toUpperCase() + "_" + document.getElementById("setSymbolRarity").value.toUpperCase() + ".png" imgSetSymbol.src = "https://raw.githubusercontent.com/ImKyle4815/MTG-Set-Symbols/master/setSymbols/" + document.getElementById("setSymbolCode").value.toUpperCase() + "_" + document.getElementById("setSymbolRarity").value.toUpperCase() + ".png"
} }
//Best for last - downloads the image!
function downloadCardImage(el) {
alert("This may not work because the canvas is 'tainted' - if you know how to avoid this please tell me :)")
var cardImageData = canvas.toDataURL("image/jpg")
el.href = cardImageData
}
</script> </script>
<html> <html>