I'm having trouble writing a path to fetch an image that exists in a different folder. I tried and it didn't work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I'm having trouble writing a path to fetch an image that exists in a different folder. I tried and it didn't work

25th Dec 2017, 4:21 PM
Jerry
31 Answers
0
check the image format whether it is jpeg,jpeg or PNG copy your pic in the same directory of your HTML page then use the image tag as you do.or use adobe Dreamweaver to avoid these linking problems
26th Dec 2017, 3:15 PM
SK Ali
SK Ali - avatar
+ 6
@Sami and @Jerry, if you want to insert an image, try to use <img> tag instead of <a> tag because its don't work. for the attribute, use src (acronym: source) instead of hreg (acronym: hyperlink reference). hth, cmiiw
25th Dec 2017, 5:02 PM
Amethyst Animion
Amethyst Animion - avatar
+ 5
try to write like this <img src="../pictures/gym.jpeg">
25th Dec 2017, 4:56 PM
Amethyst Animion
Amethyst Animion - avatar
+ 1
copy the image in the same folder where the file is saved
25th Dec 2017, 4:45 PM
prachal goyal
prachal goyal - avatar
+ 1
@sami I got it! thank you! I was only Putting the file name and not the extension
25th Dec 2017, 6:37 PM
Jerry
+ 1
"./" means your current directory. so anything after " ./ " is from your current directory. now you want to access from different folder. lets consider this folder is outside your current directory. so all you need to do is use " ../" to go one folder up. to go two folder up use" ../../"
26th Dec 2017, 7:41 AM
Pavan kaware
Pavan kaware - avatar
0
how did you tried?? and did you tried fetching image here in codeplayground??
25th Dec 2017, 4:26 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
0
no, on my pc
25th Dec 2017, 4:27 PM
Jerry
0
if your html file is in the same folder where your image file is then use <a href="image.jpeg"></a> but if it is in different folder such as: folder: images/picture.jpg index.html then try using <a href="../images/picture.jpg"></a>
25th Dec 2017, 4:30 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
0
I think that's what I did but let me try again row quick
25th Dec 2017, 4:33 PM
Jerry
0
The image I'm trying to link to is in my pictures folder on my PC. So I wrote <a href="/pictures/gym.jpeg">gym</a>
25th Dec 2017, 4:50 PM
Jerry
0
I am a beginner and I'm trying to learn how to instruct the browser to look outside the root folder for a file in a link
25th Dec 2017, 4:56 PM
Jerry
0
I don't want to insert an image I want to link to an image
25th Dec 2017, 5:03 PM
Jerry
0
Or hell any HTML file outside of the folder I'm just trying to get the hang of navigating outside of the folder with paths
25th Dec 2017, 5:03 PM
Jerry
0
I know I would use the Image Source element to insert an image on the page
25th Dec 2017, 5:05 PM
Jerry
0
@jerry did u managed to do it..??
25th Dec 2017, 6:02 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
0
no
25th Dec 2017, 6:03 PM
Jerry
0
I can't seem to link to an image file in another folder
25th Dec 2017, 6:03 PM
Jerry
0
u r missing href="../" those dots
25th Dec 2017, 6:04 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
0
I guess it's not really necessary anyway I just keep all my Files in the same site folder
25th Dec 2017, 6:04 PM
Jerry