简体   繁体   English

JPG图片未在IE和Firefox中显示

[英]JPG Images not displaying in IE and Firefox

I'm having a weird problem and it's driving me crazy. 我有一个奇怪的问题,这让我发疯。 The problem is that every jpg image is not displayed in IE and Firefox browsers, while displaying properly in Chrome and Opera. 问题在于,每个jpg图像都不会在IE和Firefox浏览器中显示,而在Chrome和Opera中却能正确显示。 What could be the cause of this problem? 可能是这个问题的原因? In IE when trying to open a jpg image into a new tab, shows me a bunch of strange characters instead of showing me the image, in Mozilla it pops in the "Save image" insted of open it. 在IE中,当尝试将jpg图像打开到新选项卡时,向我显示了许多奇怪的字符,而不是向我显示图像,在Mozilla中,它弹出来显示“打开图像”。

Thank you in advance! 先感谢您!

The server is sending images with text/plain MIME type. 服务器正在发送text/plain MIME类型的图像。 The "strange characters" are the text form of the image bytes. “奇怪字符”是图像字节的文本形式。

在此处输入图片说明

On a nginx server, add the following to /etc/nginx/mime.types to make sure it serves jpg files as an image. /etc/nginx/mime.types服务器上,将以下内容添加到/etc/nginx/mime.types ,以确保其将jpg文件用作图像。

types {
    image/jpeg        jpg;
}

For an Apache server, create an .htaccess file in the same directory as the images. 对于Apache服务器,请在与映像相同的目录中创建.htaccess文件。 Add the line: 添加行:

AddType image/jpeg .jpg

You got an JPG which uses CMYK instead of RGB encoding, and Firefox/IE choke on such files. 您得到了一个使用CMYK而不是RGB编码的JPG,并且Firefox / IE阻塞了此类文件。 You just need to convert the JPGs to RGB colorspace, or in Photoshop you can save image like " Save for web" 您只需要将JPG转换为RGB色彩空间,即可在Photoshop中保存“保存为网络”之类的图像

I found the problematic plugin, it's called "EWWW Image Optimizer" which converts the JPG images to WebP format. 我找到了有问题的插件,叫做“ EWWW Image Optimizer”,它将JPG图像转换为WebP格式。 They have an alternative rewriting in case the images are served from a CDN which seems to not be working yet. 如果从CDN提供图像,它们似乎还无法正常工作,因此可以选择重写。

Thank you for trying to help me! 谢谢您的帮助!

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

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