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

HTML How to Make a Website Creating HTML Content Add Image Gallery Content

Lucija Pilić
Lucija Pilić
4,340 Points

No problem with code here, but...

So, everything works as described with local images, but whenever I try to put external image from the web (like, some image form Wikipedia) in "img src" tags/attributes, it won't show me that image on site. It will show alt description and link to the image through alt description and paragraph text, but the externally linked image itself is missing.

Any clues why?

Edit: How do I add picture to my question, to give you a better insight to the problem?

Hey Lucija, Here is a link that'll help you post your code https://teamtreehouse.com/community/posting-code-to-the-forum. Though I can't see you code, have you included the complete absolute url for the image you want to display from another site? For example, "https://static.teamtreehouse.com/assets/apple-touch-icon-152x152-precomposed-1b11bb9390ef7214f8e93f852cc45e43.png" .

2 Answers

I see the problem. It looks like the link you've provided for you src attribute is actually a link to a file (notice the File: in your url?) rather than an image, so it won't appear as you'd like. Here is a link explaining how that works: https://en.wikipedia.org/wiki/File_URI_scheme. Try going to https://hr.wikipedia.org/wiki/Zemlja#/media/File:The_Earth_seen_from_Apollo_17.jpg, then right-clicking the image and copy the url to the image. I got https://upload.wikimedia.org/wikipedia/commons/thumb/9/97/The_Earth_seen_from_Apollo_17.jpg/1024px-The_Earth_seen_from_Apollo_17.jpg. Replace your src attribute value with that link. It'll do the trick.

Lucija Pilić
Lucija Pilić
4,340 Points

You're right! Double-clicking the image returned the right URL. Thanks! :)

Lucija Pilić
Lucija Pilić
4,340 Points

Here's part of the code that doesn't work. I could post a whole code, if you think there might lie problem.

'''html <li> <a href="https://hr.wikipedia.org/wiki/Zemlja#/media/File:The_Earth_seen_from_Apollo_17.jpg"> <img src="https://hr.wikipedia.org/wiki/Zemlja#/media/File:The_Earth_seen_from_Apollo_17.jpg" alt="something"> <p>Something 3</p> </a> </li> '''

Sorry, I'm getting used to posting code here.