Page 1 of 1

coding question

PostPosted: 14. July 2010 04:37
by gtv11
when trying to add an img i have come across a problem where it can not find the img where ever i say its destination is.
my xampp folder is at C:\xampp\xampp and my index is in C:\xampp\xampp\htdocs, i also saved my pics in that area. when coding this, where should i put as the src? :?: Thanks in advance.

Re: coding question

PostPosted: 14. July 2010 05:07
by Altrea
for example:

Paths & Files
Code: Select all
C:\xampp\xampp
  \htdocs
    |- index.html
    |- image1.jpg
    |- image2.jpg

Your image-Tags in index.html should look like this
Code: Select all
...
<img src="image1.jpg" alt="some Image" />
...


Example with subfolders
Code: Select all
C:\xampp\xampp
  \htdocs
    |- index.html
    \images
      |- image1.jpg
      |- image2.jpg

image Tags in index.html
Code: Select all
...
<img src="images/image1.jpg" alt="some Image" />
...

Re: coding question

PostPosted: 15. July 2010 04:15
by gtv11
arg, still having problems, ok heres Exactly what i have
<img src="htdocs\gtv.jpg" alt="GTV11"; width=300; height=370; border=0;>
i ave also tried
<img src="gtv.jpg>
and the entire rout
<img src="C:\xampp\xampp\htdocs\gtv.jpg">
im just not getting it

Re: coding question

PostPosted: 15. July 2010 05:29
by Altrea
gtv11 wrote:<img src="htdocs\gtv.jpg" alt="GTV11"; width=300; height=370; border=0;>

Thats bullshit!
- Why do you seperate the attributes by Semicolon?
- The src-path is related to the position of the file where the <img>-Tag is called. I don't think, that you have a htdocs-subfolder inside your htdocs-folder.
- Path-separator in webserver-paths is / not \

gtv11 wrote:<img src="gtv.jpg>

If your image is in the same folder as the html file, thats correct (except of the missing double-quotes at the end of the src-attribute).

btw.: You first had to learn how to write HTML and how to get paths in html-files running. You don't need XAMPP yet (you can open html-files directly in your webbrowser)