简体   繁体   English

PNG 图像未显示在服务器上

[英]PNG Image Not Displaying on Server

I uploaded an image to my web server just like all the images are.我将图像上传到我的网络服务器,就像所有图像一样。 I created it in Photoshop and exported to a .png.我在 Photoshop 中创建它并导出为 .png。 The image resides under The code is src="" But the browser shows that the image does not exist.图像驻留在代码是src=""但浏览器显示图像不存在。 I've set permissions to 0777, I've changed the image path, tried a different image in the same path to confirm it's reading the path right, and the image will just not show.我已经将权限设置为 0777,我已经更改了图像路径,在同一路径中尝试了不同的图像以确认它正在正确读取路径,并且图像不会显示。 You can view the link here, it will show nothing您可以在此处查看链接,它不会显示任何内容

EDIT: This is what the image is suppose to look like EDIT: Removed links for privacy编辑:这就是图像的外观 编辑:删除了隐私链接

You forgot " at the end.你忘记了“最后。
It should be like this:应该是这样的:

src="img/SccBridgeLogo.png"

OR或者

Try adding / at the beginning of the path, that should tell the browser to search from index directory.尝试在路径的开头添加 / ,这应该告诉浏览器从索引目录中搜索。

src="/img/SccBridgeLogo.png"

Note this only works if you are running on a site, running from index.html in browser will return in请注意,这仅在您在站点上运行时才有效,在浏览器中从 index.html 运行将返回

File:////

I had to use the picture tag for fallbacks and came across this issue at that point.我不得不使用图片标签进行后备,并在那时遇到了这个问题。

This use to work fine这个用途可以正常工作

<img src="images/netgraph-logo.png" alt="NetGraph Logo">

After adding the picture tag添加图片标签后

<picture>
  <source srcset="images/netbob-logo.webp" type="image/webp">
  <source srcset="images/netbob-logo.png" type="image/png">
  <img src="./images/netbob-logo.png" alt="NetBob Logo">
</picture>

In my case I was able to go down one folder from the root folder, therefore " ./ " preceding the rest of the url worked fine.在我的情况下,我能够从根文件夹下移一个文件夹,因此在 url 的其余部分之前的“ ./ ”工作正常。 You may need to back up several folders instead though, so be sure you are using the correct type of path.不过,您可能需要备份多个文件夹,因此请确保使用正确类型的路径。

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

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