From 3716bd0f393267fc55247ffed75f5def90eb5d0e Mon Sep 17 00:00:00 2001 From: Steven Tracey <steven@nevets.tech> Date: Fri, 23 Aug 2024 13:15:43 -0400 Subject: [PATCH] Add antialiasing option --- index.html | 3 +++ script.js | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 1292154..532b873 100644 --- a/index.html +++ b/index.html @@ -39,6 +39,9 @@ <label for="min-border">Minimum Border:</label> <input type="text" id="min-border" name="min-border" placeholder="Enter minimum border" value="16"> + + <label for="anti-aliasing">AntiAliasing:</label> + <input type="checkbox" id="anti-aliasing" name="anti-aliasing" checked> </div> </div> <script src="script.js"></script> diff --git a/script.js b/script.js index a062296..57f462b 100644 --- a/script.js +++ b/script.js @@ -41,14 +41,15 @@ document.addEventListener('DOMContentLoaded', function () { const width = document.getElementById("width")?.value || "1080"; const height = document.getElementById("height")?.value || "1080"; const minBorder = document.getElementById("min-border")?.value || "16"; + const antiAliasing = document.getElementById("anti-aliasing").checked; Array.from(files).forEach((file) => { - uploadAndProcessImage(file, { color, width, height, minBorder }); + uploadAndProcessImage(file, { color, width, height, minBorder, antiAliasing }); }); }); function uploadAndProcessImage(file, options) { - const { color, width, height, minBorder } = options; + const { color, width, height, minBorder, antiAliasing } = options; // Create progress bar elements const progressWrapper = document.createElement('div'); @@ -79,7 +80,7 @@ document.addEventListener('DOMContentLoaded', function () { const xhr = new XMLHttpRequest(); - xhr.open('POST', `https://api.nevets.tech/igformatter/upload?color=${encodeURIComponent(color)}&width=${encodeURIComponent(width)}&height=${encodeURIComponent(height)}&minBorder=${encodeURIComponent(minBorder)}`, true); + xhr.open('POST', `https://api.nevets.tech/igformatter/upload?color=${encodeURIComponent(color)}&width=${encodeURIComponent(width)}&height=${encodeURIComponent(height)}&minBorder=${encodeURIComponent(minBorder)}&antiAliasing=${encodeURIComponent(antiAliasing)}`, true); xhr.responseType = 'blob'; // Upload progress event