Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   Programming & Scripting (http://www.greenguysboard.com/board/forumdisplay.php?f=15)
-   -   Need Help With Pictures (http://www.greenguysboard.com/board/showthread.php?t=51132)

ngb1959 2009-01-25 10:09 PM

Need Help With Pictures
 
Hi, I was searching the internet for help with putting my pictures on my website. I know how to 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

Maj. Stress 2009-01-26 03:55 AM

Quote:

Originally Posted by ngb1959 (Post 438213)
Hi, I was searching the internet for help with putting my pictures on my website. I know how to 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 :)

cmdrcunt 2009-02-09 09:34 PM

Relative Linking
 
Quote:

Originally Posted by ngb1959 (Post 438213)
Hi, I was searching the internet for help with putting my pictures on my website. I know how to 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.
This is the long way to do it. Or called absolute path.

2.
This is still called an absolute path, since your linking to the photo from the root folder.
3.
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

dekaz 2009-02-27 03:51 PM

You can use the BASE html tag.

http://www.w3schools.com/TAGS/tag_base.asp


All times are GMT -4. The time now is 11:18 PM.

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