coding question

Problems with the Windows version of XAMPP, questions, comments, and anything related.

coding question

Postby gtv11 » 14. July 2010 04:37

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.
gtv11
 
Posts: 5
Joined: 24. June 2010 05:42

Re: coding question

Postby Altrea » 14. July 2010 05:07

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" />
...
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8297
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: coding question

Postby gtv11 » 15. July 2010 04:15

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
gtv11
 
Posts: 5
Joined: 24. June 2010 05:42

Re: coding question

Postby Altrea » 15. July 2010 05:29

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)
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8297
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 49 guests