Robustify image loading

This commit is contained in:
pietervdvn 2022-07-26 11:26:27 +02:00
parent 2397c73d02
commit 2f6b43796b

View file

@ -23,7 +23,13 @@ export default class Img extends BaseUIElement {
if (Utils.runningFromConsole) {
return source;
}
try{
return `data:image/svg+xml;base64,${(btoa(source))}`;
}catch (e){
console.error("Cannot create an image for", source.slice(0, 100))
console.trace("Cannot create an image for the given source string due to ", e)
return ""
}
}
static AsImageElement(source: string, css_class: string = "", style = ""): string {