从磁盘加载时不显示PNG图像 [英] PNG images are not displayed when loaded from disk

查看:80
本文介绍了从磁盘加载时不显示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图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆