从磁盘加载时不显示PNG图像

编程入门 行业动态 更新时间:2024-10-24 18:22:36
本文介绍了从磁盘加载时不显示PNG图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我创建了一个新闻应用程序,当第一次加载文章时,该应用程序直接从Web显示图像。之后,包含图像的内容将保存在磁盘上(在applicationData.localFolder中)并从那里加载。

问题是除了PNG图像外,一切都运行得很好。它们存储在磁盘上(可以使用Windows Photo Viewer显示),但不会显示在我的应用程序中而不是JPG和GIF图像。

图像链接如下form:ms-appdata:///local/16/15864/imageX.png

使用DOM资源管理器,我能够检查img标签的src属性是否正确设置,但是在PNG图像的情况下,宽度和高度都等于0。

知道可能出现什么问题? PNG必须与JPG和GIF区别对待吗?

解决方案

如果将文件复制:imageX.png为简单空白应用程序并添加< img>指向图像的标签是否显示?如果没有,那么保存png的方式一定有问题(也许为什么宽度和高度显示为0)。

I've created a news app which displays images directly from the web when an article is loaded for the first time. After that the content including images is saved on disk (in applicationData.localFolder) and loaded from there.

The problem is that everything works perfectly fine except for PNG images. They are stored on disk (and can be shown using Windows Photo Viewer), but aren't displayed in my app as opposed to JPG and GIF images.

Links to images are in the following form: ms-appdata:///local/16/15864/imageX.png

Using the DOM explorer I was able to check that the src attribute of the img tag is correctly set, but both the width and height are equal to 0 in case of PNG images.

Any idea what could be the problem? Do PNGs have to be treated differently than JPGs and GIFs?

解决方案

If you copy the file: imageX.png to a simple blank application and add an <img> tag pointing to the image does it display? If not, then there must be something wrong with the way the png is saved (and perhaps why the width and height are showing as 0).

更多推荐

从磁盘加载时不显示PNG图像

本文发布于:2023-07-27 02:54:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1219931.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:磁盘   图像   加载   PNG

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!