Google-Homepage project help


#1

Hi, I am just starting my google-homepage journey. I am having a problem with the google image. I saved the image in a image folder and can only access it if i :
img src=“C:\Users\Mirraj\Desktop\New folder/images/googlelogo.png” alt=“Google logo”

so my question is why doesn’t this work? my index.html is in New folder.
<img src=“images/googlelogo.png” "alt=“Google logo”>


#2

I am not quite sure if I understand where the logo file is saved, but I think you saved in a folder called images on your desktop.

You need to move that folder to same folder that your google-homepage project file is located. Then your src will work.

I am working on the google homepage too, but I have already done a few programming projects prior to Odin. The best way that I understand & can explain it is that the src is telling the HTML file how to access the file from the location of the HTML file. I’ll post again, but this will get you moving while I gather my thoughts


#3

For example, the path to my google-homepage folder is:
/Users/rmoser/projects/odin_on_rails/google-homepage

The path to the folder on my desktop would be:
/Users/rmoser/Desktop/images/googlelogo.png

So my index.html is in the google-homepage folder, so in order to get to the folder on my desktop, I would need the src to be something like “. . / . . / . . /images/googlelogo.png”. (But, without the spaces between the 2 periods and /. When I type 2 periods in the post, it appears as if I put 3).

Each “. . /” says to go up a folder level. For a much better explanation, check out:
https://www.w3schools.com/html/html_filepaths.asp


#4

The new folder is where index.html is, also the images folder.

Ok will check out this link, thank you :slight_smile:


#5


#6

Oh I gotcha. You have the file in two places, but you can’t get it to work in the right place.
If the image folder is in the same folder as the index.html, then the src should be “image/googlelogo.png”


#7

If you still can’t get that to work, post a link to your github repository & I’ll check it out closer.


#8

i could’ve sworn that’s what i had but now it’s working lol. Thank you again.


#9

No problem! It also could have been a typo! Sometimes there is a small typo that causes a hour-long hunt to figure it out!