开发者

Images with Base64 Automatism - Javascript (with PHP?)

I heard a lot about Baase64 Encoding for Images in Webdesign.

And i saw a lot of developers they use it for thier headlines with: data:image/png;base64,iVBORw0...

Is there any automatism (with javascript) behind? Or have they all converted & inserted ? (could not belive)

Example: http://obox-inkdrop.tumblr.com/ (- Headlines)开发者_开发技巧


First of all, the encoding has to be done on the server-side, be it :

  • automated with a script, that reads the original image file, and returns the base64 encoded string to inject it into the HTML that's being generated
  • or by hand, and directly placed into the HTML.

The base64 encoding cannot be done on the client-side, as the goal is to avoid sending the image file from the server to the browser (to minimize the number of HTTP requests).


Depending of the language that's used on the server-side, you'll probably find some function to do base64 encoding.

In PHP, you might be interested by base64_encode()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜