diff --git a/index.html b/index.html index 693a816..45297f0 100644 --- a/index.html +++ b/index.html @@ -13,8 +13,15 @@ +
+ +
+ + diff --git a/script.js b/script.js index 5a5169f..c868cf8 100644 --- a/script.js +++ b/script.js @@ -22,7 +22,7 @@ document.getElementById('uploadForm').addEventListener('submit', async function } const arrayBuffer = await response.arrayBuffer(); - downloadImage(arrayBuffer); + downloadImage(arrayBuffer, imageInput.value); } catch (error) { console.error('Error:', error); @@ -30,13 +30,13 @@ document.getElementById('uploadForm').addEventListener('submit', async function } }); -function downloadImage(arrayBuffer) { +function downloadImage(arrayBuffer, fileName) { const blob = new Blob([arrayBuffer], { type: "image/png" }); const cardElement = document.getElementById("card"); let urlCreator = window.URL || window.webkitURL; cardElement.href = urlCreator.createObjectURL(blob); cardElement.style.display = 'unset'; - cardElement.download = "formatted_image.png"; + cardElement.download = fileName + ".png"; cardElement.click(); }