Update image glitch generator; change example image
All checks were successful
/ build (push) Successful in 12s

This commit is contained in:
lilith 2025-03-05 23:35:42 +01:00
commit cf0b76efbc
Signed by: lilith
SSH key fingerprint: SHA256:WMHGS60rozMrHkA/VT+Ole85sPCLZ190yemdzY68WJo
14 changed files with 221 additions and 71 deletions

View file

@ -27,16 +27,10 @@ function loadImage(base64Image) {
let svgDataUrl;
sourceImage.onload = function () {
let svgWidth = this.width;
let svgHeight = this.height;
if (this.height > 1000) {
svgHeight = 1000;
svgWidth = (1000 * this.width) / this.height;
}
svg.setAttribute("height", svgHeight);
svg.setAttribute("width", svgWidth);
let svgViewBox = `0 0 ${Math.trunc(800 / this.height * this.width)} 800`;
svg.setAttribute("height", this.height);
svg.setAttribute("width", this.width);
svg.setAttribute("viewBox", svgViewBox);
let svgString = new XMLSerializer().serializeToString(svg);
svgDataUrl = "data:image/svg+xml," + encodeURIComponent(svgString);