从 url 添加图像 - html

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9129635/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 22:16:26  来源:igfitidea点击:

Adding an image from a url - html

htmlimage

提问by user690936

I am having trouble displaying an image from the internet on my html page.

我无法在我的 html 页面上显示来自互联网的图像。

The line is:

该行是:

<img src="http://www.somepic..." alt="pic" />

What is wrong with it? Does that only work with images that are on my disk?

它有什么问题?这只适用于我磁盘上的图像吗?

Thank you

谢谢

回答by Jamie Dixon

Based on the URL you've presented in the comments above, my guess is that you're not actually linking to an image, you're liking to a web page but mistaking it for an image.

根据您在上述评论中提供的 URL,我的猜测是您实际上并没有链接到图像,您喜欢的是网页,但将其误认为是图像。

For instance, the url you provided:

例如,您提供的网址:

http://www.google.co.il/imgres?q=picture&hl=iw&sa=X&rlz=1C1SKPL_enIL452IL452&tbm=isch&prmd=imvnsl&tbnid=BAlLxbccyZkwSM:&imgrefurl=http://animal.discovery.com/mammals/cheetah/&docid=qDOKJbIkYvvzyM&imgurl=http://animal.discovery.com/mammals/cheetah/pictures/cheetah-picture.jpg&w=625&h=450&ei=Y-grT8_ZNYnntQb4kID0DA&zoom=1&iact=hc&vpx=693&vpy=191&dur=850&hovh=190&hovw=265&tx=155&ty=84&sig=110318714666115395229&page=1&tbnh=141&tbnw=183&start=0&ndsp=19&ved=1t:429,r:1,s:0&biw=1280&bih=656

http://www.google.co.il/imgres?q=picture&hl=iw&sa=X&rlz=1C1SKPL_enIL452IL452&tbm=isch&prmd=imvnsl&tbnid=BAlLxbccyZkwSM:&imgrefurl=http://animal.discovery.com/maurlingv=1C1SKPL_enIL452IL452&tbm=ist http://animal.discovery.com/mammals/cheetah/pictures/cheetah-picture.jpg&w=625&h=450&ei=Y-grT8_ZNYnntQb4kID0DA&zoom=1&iact=hc&vpx=693&vpy=191&dur=850&hovh=190&hovw=265&tx=155&ty=84&sig=110318714666115395229&page= 1&tbnh=141&tbnw=183&start=0&ndsp=19&ved=1t:429,r:1,s:0&biw=1280&bih=656

Is the URL of a webpage showing the image, not the image itself.

是显示图像的网页的 URL,而不是图像本身。

Make sure you're linking to the actual image itself:

确保您链接到实际图像本身:

<img src="http://animal.discovery.com/mammals/cheetah/pictures/cheetah-picture.jpg" 
alt="Cheetah!" />