它是安全使用的base64 EN codeD映像的网络,优点和缺点?

问题描述:

时可以安全使用的base64 EN $ C $光盘镜像网页设计,它是如何在性能上比较?优势和劣势?

Is it safe to use base64 encoded images for web design, How does it compare in performance? Advantages and Disadvantages?

一个的base64流是不是一个二进制(不考虑通过HTTP gzip的COM pression你在的地方重约33%,如果你再认真的表演)。

A base64 stream is about 33% heavier than a binary one (not taking into account the gzip compression over http that you have in place if you're serious about performances).

如果直接把BASE64图像中的网页,它不会被分别缓存。因此,这将是沉重的使用这一形象,而不是被超高速缓存与URL作为主要的所有页面。你可能认为它有助于保持请求数量低,但实际上它是在正常情况下,没用,用户还需要在自己的高速缓存中的照片(如果你有很多图片,preFER CSS精灵,以降低请求数量)。

If you put the base64 image directly in a page, it won't be cached separately. So it will be heavy for all pages using this image instead of being cachable with URL as key. You may think that it helps keeping the request number low but in fact it's useless in normal cases where users have yet the images in their cache (if you have many images, prefer css sprites to lower the number of requests).

我不认为这是一个理由使用除了解决具体的技术问题时,就像在JSON发送图像,或保存只有一个HTML文件的一个base64形象 - 然后检查你真正需要使用的base64图像。

I don't think there is a reason to use a base64 image except for when addressing a specific technical issue, like sending an image in json, or saving only one html file - and then check you really need to use the base64 image.