Hi folks,
I am a PHP programmer. I am having a problem with image tag. I need to know the difference and the purpose of using an image tag like this
<img src="/images/new.jpg>" , <img src="images/new.jpg"> and <img src="../images/new.jpg"> i am facing a problem because of this, i am editing an existing website in which the src or href of image, style, anchor tags etc., are written like this src="/images/someimage.jpg" , when i click a link it goes up one level say for eg: the page i am in was www.demo.com/user/list/index.php. When i click a link with "new.php" it goes like this www.demo.com/user/index.php. it comes out of the link folder. Actually this site is an existing site running site well and good. but now i am configuring it in a new web server its not running for me. Please advice ASAP.

Recommended Answers

All 5 Replies

Hi,

I think the folder for new page and image is not in the same path , you need to check all files in the www.demo.com/user/list/index.php folder only.

Also

Hi folks,
I am a PHP programmer. I am having a problem with image tag. I need to know the difference and the purpose of using an image tag like this
<img src="/images/new.jpg>" , <img src="images/new.jpg"> and <img src="../images/new.jpg"> i am facing a problem because of this, i am editing an existing website in which the src or href of image, style, anchor tags etc., are written like this src="/images/someimage.jpg" , when i click a link it goes up one level say for eg: the page i am in was www.demo.com/user/list/index.php. When i click a link with "new.php" it goes like this www.demo.com/user/index.php. it comes out of the link folder. Actually this site is an existing site running site well and good. but now i am configuring it in a new web server its not running for me. Please advice ASAP.

I need to know the difference and the purpose of using an image tag like this
<img src="/images/new.jpg>" , <img src="images/new.jpg"> and <img src="../images/new.jpg">

Say for example you are in "home" directory. In home directory, there is another directory called "images".
You want to display an image called "new.jpg" which is inside images. So, <img src="/images/new.jpg"> OR <img src="./images/new.jpg"> OR <img src="images/new.jpg"> will go inside images directory and display new.jpg .
Now, consider you are in "home" directory and "images" directory is one level above "home". Then you use .. ie., <img src="../images/new.jpg"> meaning, come out of home directory (ie., go one level up) , go to images directory and display new.jpg . I hope thats clear!

Thanks for your reply,
I just want to know the difference between <img src="images/new.jpg"> and <img src="/images/new.jpg"> tag format, also I belive <img src="/images/new.jpg"> and <img src="../images/new.jpg"> are same. I am an experienced programmer so i know some basics in images.
Please advice

Say for example you are in "home" directory. In home directory, there is another directory called "images".
You want to display an image called "new.jpg" which is inside images. So, <img src="/images/new.jpg"> OR <img src="./images/new.jpg"> OR <img src="images/new.jpg"> will go inside images directory and display new.jpg .
Now, consider you are in "home" directory and "images" directory is one level above "home". Then you use .. ie., <img src="../images/new.jpg"> meaning, come out of home directory (ie., go one level up) , go to images directory and display new.jpg . I hope thats clear!

Thanks for your reply,
I just want to know the difference between <img src="images/new.jpg"> and <img src="/images/new.jpg"> tag format, also I belive <img src="/images/new.jpg"> and <img src="../images/new.jpg"> are same. I am an experienced programmer so i know some basics in images.
Please advice

./ this folder
../ up one folder
/ html root of the current site
/foldername/ foldername off the html root
./foldername/ foldername off the current folder
foldername/ foldername off the current folder (alternate)
../foldename/ up one folder then into foldername (parallel folder in the tree)
../../ up two folders
../../foldername up two then into foldername

in dos, windows cmd window type cd .. or cd . or cd ../foldername and you can see what it does

Your beliefs are wrong, ../ and / are not the same

Experienced ? dont think so

Thanks for your answers. Clear now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.