feat: image logging
This commit is contained in:
parent
fb16fb4fee
commit
09af078300
1 changed files with 3 additions and 2 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue