So I have this HTML code:
<img src="C:\Users\Nico\Documents\Sublime\Proyecto Tics\templates\logo.png" width="30" height="30">
I've tried several things to make it work but it just won't load the image, the file path is correct and when I open the HTML file and get the image path then put it into chrome it opens the image perfectly. I've also tried using "logo.png" as the source but it wouldn't work either when I copied the image path it wasn't correct so ended up specifying the whole path. Whatever I specify as path doesn't seem to load.
Don't use file system absolute path in html.
Refer HTML File Paths
C:\ is not an actual path naming convention. It is just something Google Chrome has, try using a relative path.
Related
I am using VSCode and I am trying to add an .svg file to my project but it is not appearing on the Live Server. I used the same code just different file name as the other assets and it the file just will not appear.
Here is the JSFiddle of my project: https://jsfiddle.net/sillybrownboy/netgLq94/14/
'''
<img class="about_1"
src="images/about_icon.svg">
'''
I obviously had to host my .svg files and .png files in order to get it to work but I left the code for the "about_icon.svg" the same at the bottom of the HTML.
I would check path where the about_icon.svg image is being stored. On your JSFiddle code, all the images are showing an absolute path, where the about_icon.svg is showing a relative path, in relation to that specific web page. If the about_icon.svg image is being stored on a remote server, similar to the other images, then you want to change the src location for the about_1 image to an absolute path, not a relative path.
Also, from my experience, I have forgotten to upload images or uploaded to a wrong location on the server, and have wondered why they weren't displaying.
I cant seem to get my image to display on my webpage using a relative path. Im using the program "brackets" to do all of my editing before uploading to the webpage. Below is the relative path that i'm using and when I hover over the path the image thumbnail displays. but it still wont display on the page... am I missing anything? please and thank you.
<img id="01" class ="tn leftcol" width = "150" height = "150"
src=".//Images/IMG_3604.JPG" alt="1" />
there are two slashes. this can be interpreted as a protocol. Change the src to Images/IMG_3604.JPG
If this is being populated via a variable, check the source text or environments
There are two forward slashes. It should be ./Images/xxxxx.png not .//
If you have to go out of a directory, use ../ if the image folder is in the folder you are currently in use nothing.
Src="Images/IMG_3604.JPG"
Your html file is in the same directory.
Src="../Images/IMG_3604.JPG"
Html file is in a subdirectory and you need to go outside of that folder to get to images.
Src="../../Images/IMG_3604.JPG"
Html is in a subdirectory of a subdirectory and you need to go outside of both to get to the Images folder.
Hope this helps.
I am trying to load an image locally onto my html. I first tried serving an image path through a /images/ folder, but that did not work. I then tried serving images with the whole path to the image like <img src="/Users/code/src/code/go/src/websites/website/website-Bucket.png" alt="test"> but I still had no luck. I checked my html and it has no errors. I have restarted my PC, changed the image to .jpg, and it still did not want to work. I get an error in Safari - An error occurred while trying to load the resource and the image shows as a blue box and question mark. What things would you try to troubleshoot?
Extra - I am using goLang to serve the files. I have it so a http.handleFunc() goes off and serves the images folder when it is requested. The path is showing http://localhost/images/theImage.png "the correct path" but nothing happens. So, I save the image and it shows it as a html and shows a section of the page?? Would that be a path thing?
In first instance you have to understand the path source, when you are on a HTML file, your path inside the file should be :
<img src="images/website-Bucket.png" alt="test">
that's because :
the path of your .html file can access trough files the inside path with the "/folder/file" structure route in the html file, so your structure files should be:
yourfiel.html (your file render on browser) /imagesfolder
-website-Bucket.png" (you call it on your html as
/imagesfolder/website/Bucket.png)./
you can learn more about paths here :
http://www.coffeecup.com/help/articles/absolute-vs-relative-pathslinks/
Looks like it may be a file path issue.
Take a look at this page it has a good example.
https://www.w3schools.com/html/html_filepaths.asp
Also try renaming the image with a _ and not use the -.
Open Console in any browser and see if you see any errors that mention not being able to find the source path of the picture.
It should give you a hint of where your browser is trying to find that img.
All of your guy's responses were correct. I had the correct path. It was a Golang thing. I did not make a handlefunc when the server wants the /image.png. It was never serving the image, it just was doing nothing with it. Thank you for the responses.
I'm trying to put this image I have saved in this location:
C:\Users\Administrator\Desktop\HTML docs\Lab 02\images
to put on my html code here:
<body>
<img src="C:/Users/Administrator/Desktop/HTML docs/Lab 02/images/logo.gif" alt="Sintok Pizza Order Form Logo" width="300" height="268">
</body>
And, yes, as you can see on the code, the image is named logo.gif
But the image doesn't show up on my browser, what am I missing here? Please point out my errors, thanks!
Prepend the path with file:///
file:///C:/Users/Administrator/Desktop/HTML docs/Lab 02/images/logo.gif
Better way is to use relative paths. Assuming your html-file is in
C:/Users/Administrator/Desktop/HTML docs/Lab 02/
You should use
images/logo.gif
as your path.
us file path like
file:///C:/Users/Administrator/Desktop/HTML docs/Lab 02/images/logo.gif
In these cases open file with any browser and the copy the path used by browser is a shortcut to test the path
You have been using the local computer path. Which is wrong. You need to use the web path.
See This : C:/Users/Administrator/Desktop/HTML docs/Lab 02/images/logo.gif
This is pointing to your C: drive which is only accessible from your computer not others. you need to put up the image path as something like
./images/logo.gif
Whats going wrong with my explorer or mozilla. I used the
<img src="path"/>
but the pic cannot be seen, when i open my html file. It just opens an empty box at that place.How do i make it through? I cannot display my pictures in my html file.Could you tell me which version of explorer supports it?
Make sure that your file is really named how you think it is. If you have "Hide known extensions" enabled, disable it and check again. Also, check if the extension in the path is the same case as the files. I once had a problem where images would not display in IE because of the image extensions being in upper case.
where is your HTML file and where is your image file ?
lets suppose your HTML file is anywhere and your image is in the same directory then you can give it path src="image.extension".
better you should check it in the same directory. Thanks
Make sure your path is correct.
If the image is in the same folder as your html file, then it should just be
<img src="image_name.jpg" />
If you reference your images from another folder, you will need to place the proper path in there. Depending on the file structure, it could be something like
<img src="/images/image_name.jpg" />
<img src="../images/image_name.jpg" />
<img src="../../images/image_name.jpg" />
Also check that you have
spelled the file and folder names correctly
used the right upper- and lowercase letters (this can be problem for file name extensions, like .jpg vs .JPG)
actually saved the file in the place it is supposed to be