Jump to content

Help With Images.


migroo
 Share

Recommended Posts

Hi, I am learning to program using W3schools and am having some problems with images here is the code I use:<img src="http://www.aerospaceguide.net/spacepictures/shuttle_endeavour.jpg"width="200" height="600" /> Now this will display but its not hosted by me its hosted on another website. So I have had to upload images to another website and then cut and past the url.All the examples that are given in the tutorials look like this:<img src="shuttle2.jpg"width="200" height="600" />Now where do I need to upload the image too for this to work I am using FileZilla to upload to my server.I Just don't know what folder I should upload to or if I should make a new folder or what? Any Help would be appreciated.Thanks

Link to comment
Share on other sites

Hi, I am learning to program using W3schools and am having some problems with images here is the code I use:<img src="http://www.aerospaceguide.net/spacepictures/shuttle_endeavour.jpg"width="200" height="600" /> Now this will display but its not hosted by me its hosted on another website. So I have had to upload images to another website and then cut and past the url.All the examples that are given in the tutorials look like this:<img src="shuttle2.jpg"width="200" height="600" />Now where do I need to upload the image too for this to work I am using FileZilla to upload to my server.I Just don't know what folder I should upload to or if I should make a new folder or what? Any Help would be appreciated.Thanks
You need to understand how URIs ad URLs work.If there is nothing but a filename (file.jpg), it means the file is in the exact same location as the HTML file that's calling it.
[file.jpg]Root | +- file.html | +- file.jpg

If there is a word and a slash preceding the file name (images/file.jpg), it's in a folder directly under the location of the current file.

[images/file.jpg]Root | +- file.html | +- images	 |	 +- file.jpg

This also works for having folders inside folders:

[images/other/file.jpg]Root | +- file.html | +- images	 |	 +- other		 |		 +- file.jpg

Two dots (..) means a parent folder:

[../file.jpg]Root | +- documents |   | |   +- file.html | +- file.jpg

It also works with several levels of folders:

[../images/file.jpg]Root | +- documents |   | |   +- file.html | +- images	 |	 +- file.jpg

Finally, when a URI is preceded by a slash, everything that follows is relative to the Root

[/images/file.jpg]or[../../images/file.jpg]Root | +- documents |   | |   +- HTML |	   | |	   +- file.html | +- images	 |	 +- file.jpg

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...