简体   繁体   English

在Internet Explorer中获取PNG图片错误框?

[英]Getting image error box on png in internet explorer?

I have this really weird issue with Internet Explorer. 我在Internet Explorer中遇到这个非常奇怪的问题。 I am pre-loading some images with javascript and displaying them. 我正在用javascript预加载一些图像并显示它们。 They all display fine, however there is an image error box showing up. 它们都显示正常,但是出现一个图像错误框。

Image here http://i.imgur.com/n4Lmo.png 图片在这里http://i.imgur.com/n4Lmo.png

I preload the images this way in Javascript 我预装这种方式在Javascript中的图像

function LoadImage(imageName,imageFile)
{
 if(!document.images) return;
 document.images[imageName].src = imageFile;
}
$(document).ready(function() {
LoadImage('image0','images/image.png');
});

And then I use them here in html 然后,我在这里的HTML使用它们

<img name=image0 border=0>

Again, all of the images are showing up fine. 同样,所有图像都显示良好。 This error appears in all versions of IE. 此错误出现在所有版本的IE中。

Thanks 谢谢

Is it just one particular .png that is doing that in IE? 在IE中只是这样做的一个特定的.png吗? You might want to open the image in a photo editor like Photoshop to make sure it's RGB, 72dpi, etc. I had a similar issue a while back when a client was supplying me with CMYK JPEGs, and the only browser that wouldn't display them was IE. 您可能想在Photoshop之类的照片编辑器中打开图像,以确保其为RGB,72dpi等。当客户向我提供CMYK JPEG且仅有的一个不会显示的浏览器时,我遇到了类似的问题他们是IE。 Converting the colorspace to RGB did the trick. 将色彩空间转换为RGB就可以了。

The easiest way to make sure the image will display in all browsers is probably Photoshop's Save For Web feature. 确保图像将在所有浏览器中显示的最简单方法可能是Photoshop的“另存为Web”功能。

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

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