Update image glitch generator; change example image
All checks were successful
/ build (push) Successful in 12s
All checks were successful
/ build (push) Successful in 12s
This commit is contained in:
parent
88f6a8d18d
commit
cf0b76efbc
14 changed files with 221 additions and 71 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue