Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2009-01-25, 10:09 PM   #1
ngb1959
Oh no, I'm sweating like Roger Ebert
 
ngb1959's Avatar
 
Join Date: Jun 2004
Location: In A Box, A Big Old Box
Posts: 501
Need Help With Pictures

Hi, I was searching the internet for help with putting my pictures on my website. I know how to <img src=""> etc., but how do I .....

NOT have to put in the whole http://www. etc. thing

http:///www.mysite.com/graphics/pic1.jpg

each time I want to add a pic to my page?

Isn't there some kind of shortcut that I can use to where I only have to do this ?

/grapics/pic2.jpg

??

Thanks so much for your help.

Nina
ngb1959 is offline   Reply With Quote
Old 2009-01-26, 03:55 AM   #2
Maj. Stress
Progress rarely comes in buckets, it normally comes in teaspoons
 
Maj. Stress's Avatar
 
Join Date: Jun 2005
Location: Dark Side Of Naboo
Posts: 1,289
Quote:
Originally Posted by ngb1959 View Post
Hi, I was searching the internet for help with putting my pictures on my website. I know how to <img src=""> etc., but how do I .....

NOT have to put in the whole http://www. etc. thing

http:///www.mysite.com/graphics/pic1.jpg

each time I want to add a pic to my page?

Isn't there some kind of shortcut that I can use to where I only have to do this ?

/grapics/pic2.jpg

??

Thanks so much for your help.

Nina
Nina,
You might do a search on "relative html linking" or something similar. Sometimes you will need a ../ in front of the file you are pulling the images from. Or just img src graphics/pic.jpg It all depends on where the images are on your site.
hth
Maj. Stress is offline   Reply With Quote
Old 2009-02-09, 09:34 PM   #3
cmdrcunt
Internet! Is that thing still around?
 
Join Date: Nov 2006
Posts: 6
Relative Linking

Quote:
Originally Posted by ngb1959 View Post
Hi, I was searching the internet for help with putting my pictures on my website. I know how to <img src=""> etc., but how do I .....

NOT have to put in the whole http://www. etc. thing

http:///www.mysite.com/graphics/pic1.jpg

each time I want to add a pic to my page?

Isn't there some kind of shortcut that I can use to where I only have to do this ?

/grapics/pic2.jpg

??

Thanks so much for your help.

Nina
Nina,

Relative linking is pretty easy to understand. As long as you have a basic grasp of the file system in general. The root folder (or directory in Linux) is the beginning of your path or can just be called "/" (without the quotes of course). So if you put a / in front of your path then you will be starting from the web root.

Now you can always just start from the webroot and use a / in front of your picture location. You will have to put the complete path to the file in this case.

Another alternative is to use ./ or just leave the / off all together.

So when you login with FTP your directory structure might look a little something like this:

www (this is your web root)
|_____images (this might be where all of your images are located)
|_____includes (this is where you typically put important scripts for your website)
|_____index.html (or index.php or index.asp etc. This is obviously your main webpage)


So if you are trying to link to a picture that is located in the images folder from your index.html (or .php or .asp etc) then you could do this several different ways:

1. <img src="http://www.mydomain.com/images/image.jpg">
This is the long way to do it. Or called absolute path.

2. <img src="/images/image.jpg">
This is still called an absolute path, since your linking to the photo from the root folder.
3. <img src="images/image.jpg">
This is called a relative path. You are linking from the current folder to the image.

I don't know how detailed your directory structure is but i am assuming it is pretty basic as most sites do use a pretty basic directory structure. But using option #2 is quicker and safer to use than option #3. This way if you move your index.html (or any other html or php or asp file) from one folder to another you don't have to go through and fix all of the relative paths.

Good luck!

Fred

http://www.trafficholder.com/aff.php?fbnewtz
cmdrcunt is offline   Reply With Quote
Old 2009-02-27, 03:51 PM   #4
dekaz
Just because I don't care doesn't mean I don't understand!
 
Join Date: Jun 2005
Posts: 91
You can use the BASE html tag.

http://www.w3schools.com/TAGS/tag_base.asp
__________________
I played connect the dots with your beauty marks
dekaz is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:24 AM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc