adding an image from my computer in html [duplicate] - html

This question already has answers here:
How can I create a link to a local file on a locally-run web page?
(5 answers)
Closed 6 years ago.
I'm following online tutorials to start learning HTML and I'm having trouble adding an image. What I'm doing is just typing into a txt (renamed as .html and with UTF-8 encoding, per the tutorial's instructions) document, then checking to see the code changes work properly by opening. However I cant seem to get the image to load properly when testing it, no matter what I do. Here is what I have in the text document:
<img src="C:\users\jason\desktop\website\curved.jpg">
I double checked that the path is correct, everything is spelled correctly, and that image is in the same folder as the html document. So what am I doing wrong here?

Try using the file:/// protocol if you want to link to local files.
<img src="file:///C:\users\jason\desktop\website\curved.jpg">

Just double check that it is in fact a .jpg and not a .png for example, and try the following:
<img src="curved.jpg">
I would also have the image saved in the same folder as the HTML file.

Related

Open local file on a local disk c: throught HTML page href link [duplicate]

This question already has answers here:
How can I create a link to a local file on a locally-run web page?
(5 answers)
Closed 2 years ago.
I'm trying to open a file on my local disk c: throught a link on my personal web page.
using this:
open locally
on the new "_blank" page, the url bar appears like "file///C:/myfolder/myfile.pdf", the colon (:) was removed from "file:///". The local file doesn't open just because the colon is missed.
What am I doing wrong? How can i fix it?
Try structuring your link like this
Open Locally
You do not need to add the blank window conditional as it will open with what ever your default PDF viewer is.
Remove "http://"
open locally
Local file protocol is "file://"

Cannot download a file off <a> link [duplicate]

This question already has answers here:
How to specify a local file within html using the file: scheme?
(5 answers)
Closed 3 years ago.
I try to put a link to a file in my page, such that, once a user clicks the link - the browser downloads the file.
HTML:
<a href="correct_path...." download>downloadable link</a>
Here is the image shows the full path of the link:
And here is the image shows the file does exist:
So why, when I click the link NOTHING happens? it doesn't download..
When you work with a server (local server too) the root of the urls/links must be the server, not your computer.
For example, in your case, if the root folder of your server is 'SMIS' the correct URL will be "http://localhost/SMIS/Files/6.pdf"

Image is not displaying on Read the Docs, but it is displayed on Github, what is wrong? [duplicate]

This question already has answers here:
Hotlink resources like JavaScript files directly from GitHub [duplicate]
(2 answers)
Link and execute external JavaScript file hosted on GitHub
(15 answers)
Closed 4 years ago.
I am trying to add an image to one of the .md files for our read the docs.
I am putting this on my .md file:
<p align="center">
<img src="github url where the image is" width="350" />
</a>
</p>
Once I commit, It looks fine when I look at the file on Github, but it shows error on Read the docs.
I have tried different file type (.png or .svg), with Mark Down instead of HTML, and the story is always the same: I can see it on Github, but not on read the docs...
Any clues?
Thanks!!!
Github probably protects his images from hotlinking

<a href="http://file://///> convert file:// to file// ---remove colon [duplicate]

This question already has answers here:
Linking a UNC / Network drive on an html page
(3 answers)
Closed 6 years ago.
I need to open filelink (network share in local) in the browser.
I use such code:
<a href="http://file://///server/localfolder">
It open link in the browser but convert it to such format:
file/////server/localfolder (remove colon).
This way browser don't open local folder.
I have tried to change file:///// to file:// or file:/// or file://// . But colon stell removed by browser.
How to solve it?
You can't specify more than one protocol definition as part of a URL schema. You shouldn't link to file:// either, really, but if you absolutely must, just remove the http:// definition as follows:
<a href="file:///server/localfolder">
You can read more about file: protocol, and in particular its implementation in the following links:
Wikipedia Article
Another SO question (with very good answer)

Including images in a Genshi/Trac template

I am trying to include some images in a Genshi template for my Trac plugin, but it always shows only the alternative text because it cannot find the images.
I have the following (X)HTML code:
<div>
<img src="file://c:/path/to/image.png" alt="asdf" />
</div>
When I use this code with a simple html file and open it in the browser, the image is displayed correctly, which means that both the path and syntax are correct.
But when I insert the code snippet into a Genshi template and use it within Trac, the image cannot be found. However, when I look at the HTML source code in the web browser and copy the URLs into a new browser tab, it is again displayed correctly. This means that only the server cannot find the image.
The images are in a directory inside the python-egg file, and the path points directly to the directory created by Trac, which also contains my CSS and HTML files, both of which are loaded correctly. The images are correctly referenced in the setup script which creates the egg.
How do I have to reference images in (X)HTML documents when using them with a server?
Is there a special way to include images in Genshi documents? (I haven't found one.)
Thanks to the comment of RjOllos and this site I was able to fix it by trying all of the URL types. Although it says for a plugin to be /chrome/<pluginname>, it was actually just /chrome that worked. See the edit below! So the full URL is then <ip>:<port>/chrome/path/to/image.png.
EDIT: I discovered I actually used the /chrome/pluginname version, just that I did not use the name of my plugin as "pluginname". See my comment below. It seems like /chrome/pluginname should actually be /chrome/htdocsnameor something like that, in case you use a different name rather than the plugin name when implementing the ITemplateProvider. In my case I called it images, which was the same name as the folder. END OF EDIT
Another mistake I made was forgetting the initial slash (chrome/path/to/image.png), which caused Trac to assemble the URL to <ip>:<port>/<current page>/chrome/path/to/image.png.