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