Can you not use relative urls if all the images are in the same folder? If I open my html file, test.html, on my desktop, and I have the following element in it:
<img src = "./my-image1.png" />
and my-image1.png
is in the same folder as my .html file, it will display.
The key is to include the ./
.
As for javascript, you could use javascript to replace all your src
attributes throughout your html file. Once you have all your images in the same folder as your .html, try something like this.
<script>
var imageTags = [...document.getElementsByTagName("img")];
let regex = /([\w\d%]*\.(png|jpg|jpeg|gif))$/
imageTags.forEach(element => {
result = element.src.match(regex);
element.src = "./"+result[0];
});
</script>
That way you don't have to go through and change all the tags yourself. Just add that script to the bottom of the page.
edit: reading some of the answers, some people are saying that SD cards store their files differently than regular directory paths, so my solution might be pointless. But I'm not sure. I think it's worth trying.
It worked for me on my local browser. Hope it works for you.
<root name="root" path="."/>
to the paths-xml file to display the html text. But sorry... your img tags will not work as there are no relative paths possible if you use a FileProvider. – Aerobic