html beginner coding: image won't show up - html

I have just started to learn about coding today. I'm learning from a video on Skillshare, which isn't probably the best but I guess it will work for the basics. I know that I am supposed to type this: <img src="image link"> but when I do it and refresh it it doesn't show up on the webpage. If I do it on this website it works. Tips?
Thank you in advance

First advice is to clear your browser cache, then try opening the broken image in a new tab or view source and check the image link to see if you have the path to your image entered correctly. Also sometimes the extension needs to be exact on some browsers jpg or png won't work if the file is written JPG or PNG.

Maybe you could post your code on the image link but I suspect the image path is incorrect or missing. <img src = "flower.jpg"> will look for the flower.jpg file in the same folder as where your html file is being stored. Browswer will look for different locations for the flower.jpg file for these examples : <img src = "\images\flower.jpg">, <img src = "http://www.nat.com/flower.jpg">, the former it will look for a sub-directory called images from the current directory. The final example allows you to get the image file directly from a URL if you know such a file exists.

Hi as stated <img src="image link"> is not working due to several reason such as incorrect path. Normally the html will look to the direct path for html stored location to find the image.
Example will be <img src="test.png"> if file does not exist named test.png it will return broken image such as like this now back to your question you have stated that
If I do it on this website it works
this is because the website have already have a image in the server name according to your <img src="image link"> that is why it is working inside the website. Hope this explanation answered your question good luck.

Related

HTML image not showing why

code:
Why am I not able to see any image here to open amazon?
NOTE: image is saved as th.jfif on my desktop and not in any folder
was expecting to see the image
The issue you are having is very likely due to your image not being in the correct location from where your img is expecting it to be.
I would say take the image from your desktop and place it in a folder, maybe called site. Then put your HTML file and image file in the same site folder and load your page again. Then your path mapping should be accurate and your image will render.
I say it is your path mapping because rendering your HTML link using an online image works just fine.
<img src="https://turnerduckworth.com/sites/default/files/styles/case_study_single_image_s_2x/public/2019-03/5_Amazon_Lettermark_2560.jpg?h=a92f03cd&itok=2nBmNv14" alt="website" width="100">
Surely this is to do with having no file or folder structure. Your image and web page must be detailed relatively to each other.
<img src=" path to the image from the web page location ">
If your web page has a folder with it called images and inside it are all your.... images.
The path will be
src="images/picture-title.jpg"
Read about file structure. To begin with, put your web page inside a folder of it's own and also in that folder create an images folder.
I suspect the path does not match the location of the image you saved. the whole tutorial is on here .
for the example, you saved your image in path images , so you should should type it like this:
<img src="/images/th.jfif.jpeg">
and don't forget to write down the image file extension clearly. hope its help

HTML image not displaying even though the path in the img tag is correct

I am trying to display an image in my Angular project using HTML. The code is shown below
<img src="../../../../../Uploads/1640665063123--hc-Freeport.jpg" alt="Test">
I have verified that the link is correct. The file type is also correct. Additionally, the image has not been corrupted in any way since I can open it in Photos, Visual Studio Code, and Google Chrome. However, the image does not load in HTML. Instead, the "Test" text is shown. Can anyone give me some advice? Am I missing something?
The links below show the structure of my project. The second link shows the file in which the home-page component is located, which is where the image is supposed to be displayed.
https://ibb.co/Qj8HZy5
https://ibb.co/4JSk8g2
Try putting the image file in assest folder and use this path,
<img src="assets/Uploads/1640665063123--hc-Freeport.jpg" alt="Test">
I have had this problem before when making a website. Try to use the full path from the root or maybe try to use a different text editor or browser.

Why won't my image display despite correct src address? [html]

i'm new to html and css and i've decided to utilise my time spent commuting by doing a little coding on the go. As such, i've started a practice project using Droidedit for android, on my Galaxy S7, but now i've hit a bit of a head-scratcher. Attached images below:
With full URL code and result with full URL
With relative URL code and result with relative URL
Not sure where i've gone wrong here. The image is in the same directory as the html file.
Thanks in advance peeps!
You don't need that last "/" at the end after the jpg
I guess there could be an issue with path used to show the image. Instead of following
<img src="internal storage/download/htmlearning/jotpage1.jpg/" ...
try
<img src="jotpage1.jpg" ...
since your HTML file and image file are at same folder

Trying to add an image in HTML?

I use Sublime Text 3.0 to code html-based website. As indicated by my username, I'm not much of an expert. I'm having trouble adding an image with sublime text 3.0 using the latest google chrome browser version 44.0.2403.130 m and I run windows 8.1 pro (still waiting for the upgrade to w10 Dx) anyway, I'm pretty sure my software isn't the problem. I can upload images using a externally linked image such as
http://www.examplesite.com/picture.gif
and it will appear but when I try to upload from my own directory as such
<h1><img src="Logo.jpeg" alt="Logo"/>Prespective News</h1>
It will not show up on my web browser, it just shows the alternate text of Logo, is there something wrong with my code? Please help me, I've spent at least 4 hours. trying to figure it out! also it's all my pictures, not just 1.
The image is in the same directory as my HTML file is. When I do the F12, it shows an error:
Failed to load resource: net::ERR_FILE_NOT_FOUND file:///C:/Users/Owner/Documents/My%20Web%20Sites/Website%202/Logo.jpeg
This is confusing because this is exactly where my file is in:
C:\Users\Owner\Documents\My Web Sites\Website 2\Logo.JPEG
The html file is in
C:\Users\Owner\Documents\My Web Sites\Website 2\idk yet.HTML
The img src URL you provided was probably incorrect. If you open chrome dev tools (F12) you should be able to see (on the network tab) where the image source you are trying to fetch is. Then you can compare it to the path your image actually resides.
Things you can do:
Check if the name matches the one you provide exactly (case sensitive)
Remember the sources you link are relative to your page, so if you put it in a folder it might need to be src="images/Logo.jpeg"
You might be using jpg instead of jpeg, please check that also.
When coding a website you should keep all the required images in a separate image folder and use the source address appropriately.
Suppose you have an image folder in your current working directory then use
img src="image/logo.jpg" />
The reason for this error is your image not found in your specific folder.
Provide correct folder name for the image path. This issue can be easily solved. Use Firebug or F12 keys for troubleshooting.
I usually put my images in a folder aside to the html file so in the same directory
<img src="images/image.jpg" alt="image" title="image of an image" /> <h1>Titre1</h1>
Try it this way maybe. I would seperate the title h1 from the image.
If it doesn't show up it's because Logo.jpeg isn't in the same directory. Since your file name is Logo.JPEG it should be:
<h1><img src="Logo.JPEG" alt="Logo"/>Prespective News</h1>
Capitalisation matters.
I found out what I was doing wrong. Turns out the file is a JPEG but for some reason it's extension is .JPG not with an E. I'm not sure why it's not listed as a .JPEG since the file type is JPEG, anyway thank you for your responses ya'll! I probably wouldn't have figured it out if I wasn't responding and looking at the picture information xD

HTML <img src> wont load my images

Im at a loss with this, im creating a mobile version of my website with jquery, but my images are refusing to load with img src tag.
<img src="images/me.jpg" width="200" height="267" alt="me">
ive tried using to load my image straight from my website but they're refusing to load also, and moving the image to the same directory as the web page, but still nothing. I just get a box the size of the width and height with the alt text and an image icon in the middle.
I just don't understand whats wrong with it.
thanks in advance.
Try to work with the full path as:
<img src="http://www.yourdomain.com/images/me.jpg" width="200" height="267" alt="me">
For test purpose just open http://www.yourdomain.com/images/me.jpg and you should see the image. If it does not work, there must be a compatibility issue with your html/jquery. Just post the rest of your html file and tell us about the jquery plugin(s) you are using ...
My images were in fact corrupt or not working properly as I couldn't open them in Photoshop, I had to replace the images.
I have just had the same issue. It was capital letters in the filename. Some pictures were loading some weren't. Some pictures had uppercase .JPG file extension, and some had lowercase .jpg. My HTML code referenced all of the images using lowercase .jpg.
I'm running webserver on my Synology DS.
I just started writing html last night so this is a total noob response because i just had the same problem, but if youre on a windows computer then your slashes in the file location should be back slashes instead of forward slashes
like i said- total noob but hope it helps
Make sure that you are in the right subdomain in case you are using dev, staging etc.
I was wondering too, until I figured out that I am on the staging domain where the image does not exist.
Also make sure to clear the cache.
If you try different things and it doesn't work, just move your image file to your working folder where your HTML file is.
The following works:
<img src="me.jpg" width="200" height="267" alt="me">
Be aware if you are using thymeleaf. Then you must have source like: (It by itself go through and do not take repository paths,...).
<div id="upperPart">
<img id="foxPicture" th:src="greenfox.png" height="200" width="200" alt="Green Fox logo"/>
<a class="Mr.Fox_description">This is Mr. Fox. Currently living on pizza and lemonade. He knows 2 tricks. </a>
</div>
One other possible cause is your server has a bug which has crashed it. When that happens, it will show the same error.
If your server auto-restarts on crashes, it can be difficult to reproduce this bug to fix it.
This happened to me while using PM2 with NodeJS.
List item
Just go the image location on your drive
select the image
open it using your favourite browser
go to url bar
copy the location from the url bar
use it in img src=(paste over here)
It will look something like this
img src="file:///C:/Users/Mercy/Documents/WEB%20DEVELOPMENT/HTML5/lion.jpg" alt="Lion profile picture" height="300" width="500"
I've solved my problem by replacing src="image.jpg" with src="file:///c:\FULL_PATH\image.jpg"