feat: image logging

This commit is contained in:
Tomáš Mládek 2022-12-07 17:41:33 +01:00
parent fb16fb4fee
commit 09af078300

View file

@ -394,8 +394,9 @@
function processImages(document: SVGElement): SVGImageElement[] {
const result: SVGImageElement[] = [];
Array.from(document.getElementsByTagName("image")).forEach((image) => {
console.debug(`[SVG/IMAGES] Found image #${image.id}.`);
const origPath = image.getAttribute("xlink:href").split("/");
const href = image.getAttribute("xlink:href");
console.debug(`[SVG/IMAGES] Found image #${image.id} (${href}).`);
const origPath = href.split("/");
let newHref = `content/images/${origPath[origPath.length - 1]}`;
newHref = newHref.replace(/jpg$/, "webp");
image.setAttribute("xlink:href", newHref);