Hi, thank you for your reply, I get the idea. I was thinking about a similar approach but thought there would be a better option. But thanks, I will give it a try :)
Posts made by JanLoebel
-
RE: Access Image/Asset from JavaScript
-
Access Image/Asset from JavaScript
Hi there,
I have a question/problem regarding my report I want to create. I have a map (leaflet) and want to add a customized marker with different icons, depending on the incoming data. Therefore I have a custom MarkerIcon which creates an IMG-Html-Tag and set the src to the image.
_createCategoryPin(categorieId) { const pinSvg = document.createElement('img'); const imageSrc = `{#image ${categorieId.toLowerCase()} }`; const imageSrc2 = '{#image ' + categorieId.toLowerCase() + '}'; const imageSrc3 = '{#image 506e1ae7-998d-4d63-aa6c-e5bb6a170b2b}'; console.log('imageSrc:', imageSrc, imageSrc2, imageSrc3); pinSvg.src = imageSrc; return pinSvg; },
imageSrc
andimageSrc2
are not working,imageSrc3
is working.I'm pretty sure that handlebars find
imageSrc3
as a valid "to be replaced" and replace it with the matching value.imageSrc
andimageSrc2
build at runtime after Handlebars was already executed so it won't work.
Can I execute the handlebar helper afterward again, or is there any other way to access my images in JavaScript dynamically?I appreciate every tip :) Thank you so much!