简体   繁体   English

如何从 Flask 中的链接显示图像?

[英]How can I display an image from a link in Flask?

Let's say I have an image link: https://i.imgur.com/pPMi9ES.png假设我有一个图片链接: https://i.imgur.com/pPMi9ES.png

In my index.html the I have an HTML img element as following, but the image is blank after all.在我的 index.html 中,我有一个 HTML img 元素如下,但图像毕竟是空白的。

<img src="https://i.imgur.com/pPMi9ES.png" width="400px" height="300px"/>

How can fix this?如何解决这个问题?

if you are working on local server and have address like this 127.0.0.1 try changing it to localhost.如果您在本地服务器上工作并且有这样的地址 127.0.0.1 尝试将其更改为 localhost。 It worked for me.它对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM