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 trialLee Ann VanWinckel
1,480 PointsHow can I display/show image file path to use in code
I have tried searching my Mac's "help", dragging and dropping the image to text editor's file path, and have tried adding the ".." to the code to bypass part of the file tree: these have not worked.
7 Answers
Jeff Busch
19,287 PointsHi Lee Ann VanWinkel,
To begin, there is no href in an img tag. your code should look something like this:
<img src="Portland Art Museum logo.jpg" alt="Portland Art Museum logo 'experience the power of art'">
Also, if the image is not in the same directory as the file calling for it you will have to specify this. Examples would be:
<img src="img/Portland Art Museum logo.jpg" alt="Portland Art Museum logo 'experience the power of art'">
to go down one directory to the img directory, or:
<img src="../Portland Art Museum logo.jpg" alt="Portland Art Museum logo 'experience the power of art'">
to up one directory. Also, I would avoid using blank spaces in file and directory names.
Jeff
Matias Valenzuela
7,554 PointsSubmit the code to see what is the problem please
Lee Ann VanWinckel
1,480 PointsAlright, but this is code referring to an image in my personal images, so it does not tell you whether the path is correct:
<img src=img/culture.concert hall.jpg" alt="Seating and ornate ceilings inside of a formal concert hall">
<img src=a href="..Portland Art Museum logo.jpg" alt="Portland Art Museum logo 'experience the power of art'"><br>
Lee Ann VanWinckel
1,480 Points<img src=a href="..Portland Art Museum logo.jpg" alt="Portland Art Museum logo 'experience the power of art'"><br>
Lee Ann VanWinckel
1,480 Pointsalso incorrect: ````
<img src=a href="Portland Art Museum logo.jpg" alt="Portland Art Museum logo 'experience the power of art'"><br>
Matias Valenzuela
7,554 PointsYou have to use at the beginning and end
Lee Ann VanWinckel
1,480 PointsCan you clarify? What am I using at the beginning and end? Thx.
Matias Valenzuela
7,554 PointsUse (```) Markdown cheatsheet or nobody will be able to read your code
Michael Wiss
19,233 PointsOn a Mac you can control + click on your image, look under "get info" and it should reveal it's path.
file paths and leaving out a ; or end are my most common and maddening mistakes
Lee Ann VanWinckel
1,480 PointsMichael ~ I can get info but not the file path per se, so I need to see the path and how it relates to my text editor.
Lee Ann VanWinckel
1,480 PointsThx Jeff. This is also not working:
<img src="../Portland Art Museum logo.jpg" alt="Portland Art Museum logo 'experience the power of art'"><br>
Jeff Busch
19,287 PointsConsidering I don't know where the file is in relation to the file calling for it I can't really help you with the path. What I will suggest is putting the image file in the same directory for now. Also, make sure the capitalization is the same. And, I would rename the file without spaces. With a little work I'm sure you'll figure it out.
Lee Ann VanWinckel
1,480 PointsCraziness! After much labor (intermittently for a day or so), I did get my first image to load!
I was able to drag and drop to my desktop so that the image was in the same directory in that sense, at least.
Lee Ann VanWinckel
1,480 PointsLee Ann VanWinckel
1,480 PointsI may go back to the start of the lessons to view the code there, although it would be nice to know the coommand to view the image path.