How to include assets inside of an HTML file?

I’m trying to include an image inside my repl, but it isn’t working. I’ve tried this:
<img id="loding" src="https://replit.com/@wooga123/tempo-tcg#assets/load.gif">
and this:
<img id="loding" src="./assets/load.gif">
but the image isn’t loading. How can I do this?


This is a screenshot of my editor, I’m trying to load the image labeled “loding”.

https://replit.com/@wooga123/tempo-tcg#assets/load.gif isn’t an image. It’s a webpage.

he said he also tried ./assets/load.gif

Yeah, I just clicked the “copy link” button on the file tree. I assumed that was why it didn’t work. But the other thing I tried should work, right?

I think it has something to do with your CSS or the layering on the page.

No, I’m quite sure that the image isn’t loading at all – here’s a screenshot of the webpage in its own tab:
image

Try adding app.use(express.static('assets')) to index.js and change it to src="/load.gif">. This worked on my copy of the repl.

Thanks, that worked for me!

Are you able to mark my answer as the solution?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.