HTML 图像问题

发布于 2024-10-12 18:31:00 字数 364 浏览 3 评论 0原文

我正在尝试做一些 HTML 布局,我的问题几乎就在这里:

<img src = "https://something.com/image.png">

导航到 URL 时图像可以显示在浏览器中,但不能显示在 Microsoft Visual Studio 中(或加载此 HTML 页面时的浏览器),它显示为损坏的图像。这让我相信它不能以这种方式链接到(因为我可以通过这种方式查看其他图像)。我想知道它是否与需要安全的 http 连接有关,以及是否有任何解决方法。

基本上,当 url 被导航到时,图片就会出现。但是,当打开此显示图像的 HTML 文件时,它会显示为损坏的图像。我想知道这是为什么。

谢谢。

I'm trying to do some HTML layouts, and pretty much my problem comes in here:

<img src = "https://something.com/image.png">

The image can be displayed in a browser when navigating to the URL, but not in Microsoft Visual Studio (or the browser when loading this HTML page), it displays as a broken image instead. This leads me to believe it cannot be linked to in such a way (as I can view other images this way). I'm wondering if it has anything to do with it requiring a secure http connection and if there's any way around this.

Basically, the picture comes up when the url is navigated to. However, when opening this HTML file that has the image displayed on it, it comes up as a broken image. I'm wondering why this is.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

临风闻羌笛 2024-10-19 18:31:00

为此,您需要建立安全连接。当浏览器遇到您放置为图像 src 的 url 时,它会向该服务器发送请求,该服务器通过提供它支持的不同加密方法进行响应。但是,由于您将作为 http 数据浏览页面,因此您将无法理解响应(如果另一方是 http,则应该是图像数据,而现在恰好是对加密方法的查询)。简而言之,您缺少 SSL 层来使通信变得合理,因此您会看到损坏的图像。

You 'll need to establish a secure connection to do that. When the browser comes across the url you have placed as src of the image it sends out a request to that server, which responds by offering different encryption methods it supports. But since you 'll be browsing the page as http data you won't be able to understand the response (which is supposed to be image data if the other side is http and now happens to be a query for encryption method). In short you are missing an SSL layer to make your communication sensible and therefore you see a broken image.

凯凯我们等你回来 2024-10-19 18:31:00

尝试将其设置为 css 中的背景图像。

编辑我对这个问题投了反对票。我应该在序言中说我不确定,并且正在进行疯狂的猜测,如果有什么可以提供提问者未提出的想法来帮助解决问题:)

Try making it a background image in your css.

edit I am getting down voted for this question. I should have prefaced that I am not sure and was taking a wild guess, if anything to offer an idea that was not presented by the asker to help solve the problem :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文