I can't get images to work

I keep trying to add images to my repl but nothing will work, Ive tried moving the file into different folders then trying to run the repl, but it won’t accept anything.

I was casually just making a breath of the wild guide webpage because I have nothing better to do until I can get tears of the kingdom, so when I tried to add an image (.webp and .jpg) nothing worked and I kept getting Mario’s Blue Question Block.

Replit page: https://botw-fanpage.nolanbaladi.repl.co/__repl if it helps

pls help, I need it

Hey @NOLANBALADI!

Can you try renaming your image to something without a period (then change the src to your new image)? Hope this helps!

The one with numbers is just a random image I tried to use so I could see if the file format was a problem but I’ll try

I took away the period but it still won’t work

Ive also tried using a different type of code to get the image to work but still, nothing

Your HTML file’s path is Divine Beasts/Vah Medoh/vahmedoh.html, so it’s looking for the image in Divine Beasts/Vah Medoh/, but the image is not in that folder. So instead, use ../ in front of the image name, so

<img src="../1682261898.938819.jpg" />
2 Likes

Sorry but it didn’t work

1 Like

It actually needs to go one more directory up, like so:

<img src="../../1682261898.938819.jpg" />
3 Likes

was also changed to 1682261898938819.jpg

Yeah, and to note @NOLANBALADI it’s fine to have dots in the filename as long as there is another dot with the extension after. Examples:

:x: Bad filename: myfile.png.cool
:white_check_mark: Good filename: myfile.cool.png

1 Like

You would also add ../../ to the beginning when referencing the Vah Medoh picture, like this:

<input type="image" id="image" src="../../Vah Medoh.webp">
2 Likes

Or you could just start the path with a / to refer to the root directory.

<input type="image" id="image" src="/Vah Medoh.webp">
1 Like

That’s a relative path, meaning that the / would just be in the same directory as the HTML file. (which the HTML file they showed is not in the root directory).

1 Like

No, a slash means start at the root directory. It designates an absolute path. See this Stack Overflow answer:

1 Like

@boston2029
I already know such ways to add pictures in a webpage, but the image just won’t show up on the website there is nothing wrong with the code, that I am aware of, I just can’t get images to work

If you put a / infront of your image URL, it should work for you.

1 Like

Have I not done that already?

1 Like

In that screenshot, it doesn’t look like you did.

1 Like