How do I make my Html Image Source from a file path? - html

I am trying to insert an image from my computer into my HTML page (hopetnorman.pythonanywhere.com) and it's not working. Here is the code:
<img src="C:\Users\Alan\Downloads\Thomas Logo\Dogo.jpg" height="50px" class="Barpic">
Anybody know why?

It sounds to me, like you're trying to put a local file into a hosted page. This would not work, because the hosted page does not know where "C:\" is.
For it to work on a hosted website, you need to upload it from your computer to the page, or at a service that hosts your pictures and use the path to that online picture to your html site.
It would need to look something like this:
<img src="http://hopetnorman.pythonanywhere.com/Thomas%20Logo/Dogo.jpg" height="50px" class="Barpic" />
Or if the picture lies in the same folder as your page.
<img src="./Dogo.jpg" height="50px" class="Barpic" />
Also for code posts, there is a button "{}" while editing.

Maybe the best way will be if you put your image into folder where you have your html file then:
<img src="Dogo.jpg" height="50px" class="Barpic">
Or make another folder in folder where your html is for all your images:
<img src="folderWhereIhaveHTML/folderForImages/Dogo.jpg" height="50px" class="Barpic">

I figured out a way -
I posted it on imgur then copied the image address from there.

Related

Image doesn't show HTML

I am completely new to coding and I am doing the responsive web design course on free code camp. I am trying to make a french bakery website to learn web development, but when I put an image, it doesn't appear. I tried to use an URL instead but it didn't work. So I tried the solutions that I saw on this website and others but none of the solutions worked. Thank for your help.
The code
The result
Replace images/Baguettes.jpg by Baguettes.jpg because you don't have a folder named ìmages
You don't have any images folder
Do this:
<img src ="Baguettes.jpg">
Instead of:
<img src ="images\Baguettes.jpg">
As you have define wrong image path because your image is not in image folder so please replace the following
<img src ="images\Baguettes.jpg">
with
<img src ="Baguettes.jpg">
or if you want the same path
<img src ="images\Baguettes.jpg">
then please add your image in "images" folder

html beginner coding: image won't show up

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.

Images inside WebContent are not shown in html page

I read adding image to eclipse web project which should be the same problem as I do.
But the solution is not working for me.
I also have the same folder called images inside WebContent, and i have a jpg image inside it. And in the html web page, i use <img src="images/qrcode.jpg" /> . The page does not show the image, I also tried, <img src="/images/qrcode.jpg" /> <img src="../images/qrcode.jpg" /> but they not work either.
Can any body help me with this?
PS: I use the below code to to go to my page(wodinow is the project name, the html is inside the folder of pages)
response.sendRedirect("/wodinow/pages/userhelp.html");
have you checked given extension is correct? may be JPEG, jpeg. If nothing is work post your folder structure.

how to access images from root directory on subdomain

I have website.com/img and have subdomain sub.website.com and would like to access images from the img folder on my subdomain but when I try the below the image isn't showing. Any help?
<img src="../../img/1.png">
<img src="../img/1.png">
<img src="/img/1.png">
<img src="//website.com/img/1.png">
Your question is forces us to make a lot of assumptions. Are you using Apache? What does Apache's config say sub.domain.com's serving directory is?
Use full url of the image file. So that, you can display in any pages...
<img src="http://www.url/images/image.jpg" />
I think, this will help you out.

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"