简体   繁体   中英

Browser support: png files with jpg extension

While using PrestaShop 1.6 even if you set it to store all images as png, and they in fact are, the PS always adds .jpg extension instead of the correct one (.png), however it works anyway (at least in Chrome).

Does all common browsers treat images according to their file header? Or is there some major browser that I need to consider and repair core(which I would really like to avoid) to use correct extensions?

Thanks

Browsers don't care about the file extension at all, but they do care about the content type in the HTTP header. The server generally uses the file extension to determine what MIME type to put in the HTTP header, so it may end up sending the images with the wrong MIME type.

However , once the browser has determined that the MIME type is an image, they don't tend to be picky about the image format. There may be some special cases, but both PNG and JPEG files have an easily recognisable signature in the beginning of the file, so the browser can easily see what the format actually is.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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