Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
daniel jolly
272 PointsHelp with images in HTML
New to Treehouse! I need some in depth explaining on how to get the images to upload correctly. I'm using the <img src="" coding but I believe I'm doing something wrong when it comes to the url description. Is there an easy way to do this? Thanks for any help.
daniel jolly
272 PointsSo for example if I have an image in my pictures folder it should be <img src="pictures/image.jpg" alt="name of image"/> ??
Francisco M. Martin AcuƱa
1,131 Pointsimagine that you have a folder called "images", and in this folder you have all the images of your project, imagine one of these images is called "treehouselogo.jpg" and other image is called "logotreehouse.png":
You have to put this: <img src="images/treehouselogo.jpg" alt="Treehouse Logo"> <img src="images/logotreehouse.png" alt="Logo Treehouse">
(Alt is a name referece of the image (I think xd), but you can put "<title>" to display the name of the image when hover over.)
<img src="images/pokémonpikachu.jpg" alt="Pikachu the Pókemon" title="Pikachu, Electric Pokémon">
I hope you have served, I too am a newbie. you'll see, this is very easy and we will present later gords problems, Good Luck!
Francisco M. Martin AcuƱa
1,131 PointsBFF..... The forum does not allow put more than 2 tags in the same comment, AFTER "You have tu put this:" are this, it's very easy my friend:
<img src="images/treehouselogo.jpg" alt="Treehouse Logo">
3 Answers
Sharon Walls
9,234 PointsWelcome to Treehouse! The URL will depend on where your files are stored, but it will look like file paths you're already familiar with.
The URLs for images are either:
- Absolute: The URL shows the entire path. Example: "http://www.mysite.com/images/anotherfolder/image.jpg"
- Relative: The URL starts from where you are currently in the directory structure. Example: If you're calling the image from a file located in the "images" folder, use only "anotherfolder/image.jpg"
- Root relative: The URL starts from the root directory. In other words, the main domain is assumed, but the rest of the file name is shown. Example: "/images/anotherfolder/image.jpg"
Online URLs will look very familiar to you (.com) but you are likely also familiar with offline file paths too: C:\Windows\My Documents\Photos for example.
Nick covers image basics in the Images and Lists section of the Build a Simple Website project, but I found Randy's explanations in the Cleaning URLs with Subfolders topic more helpful. The PHP may not make sense to you yet, but the terms (absolute, root relative, etc) are explained quite well.
daniel jolly
272 PointsThank you! Makes sense now. I went to the properties of the image and put the whole file location and that seemed to work.
Dennis Anthony
422 PointsHi, Good day to you. I am new to TreeHouse.com. I have a problem like
After coding to view image, i have problem viewing the image on index.html page for example <img src="img/logo.gif" alt="Smells Like Bakin"> after coding this i cannot view image. What is that i am doing wrong.
Francisco M. Martin AcuƱa
1,131 PointsFrancisco M. Martin AcuƱa
1,131 PointsI'm new in treehouse too, but I think that this is what you want:
<img src= "folder/image.jpg" alt="mini title image">Sorry for my bad english