Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Is this image inlining thing something new?

No, it's been around since forever. Just not used terribly often.

> Am I reading it correctly that the images are encoded in base64 and delivered as html? Surely this is a bad idea... no?

It depends. Making a new request to fetch the image always has overhead. Whether that overhead is bigger or smaller than the overhead of base64-encoding the image depends on:

• file size (naturally)

• file compressibility: The difference isn't as pronounced after gzipping everything, especially if the source data is somewhat compressible

• protocol: http2 allows a correctly configured server to push attached data with the original request, so no second request is needed. Even without server push, http2's multiplexing will reduce the overhead drastically compared to plain HTTP1.1 or the worst case, HTTPS1.1 to a different domain. The latter requires a full TLS handshake, and that's what, >30kb data exchanged if you have more than one CA certificate in the chain? That's a lot of image data.



You forgot the most important factor: Whether you're reusing that image on a different page. Embedding images in the HTML is basically saving an HTTP request at the expense of not being able to cache the image separately from the HTML.


You can, however, embed images in CSS, which gives you both reduced requests and caching.


Unless you inline the CSS ;-)


This seems like it should work, but have you ever tried it? Or, can you point me to some results of a test to show that it indeed caches the image embedded in the CSS?


If it's inline, then it's cached with whatever it's inlined into.


The problem is that now it's going to be sent with every request. So it'll make the first page faster for the initial request, but slower in the long run.


I'm not sure how you figure that? The CSS file containing inline images would get cached, so nothing would be sent after the initial request.


Exactly! On a typical site, a lot of images are reused across pages, if externalised then it's already cached in your browser.


Completely offtopic, but how do you type •? I like it.


It's system dependent.

On windows you can do alt+numpad 2022

On whatever is handling input for this XFCE system, control+shift+U 2022+Enter types it.


And since I'm lazy, I put it on AltGr+, with xmodmap.


• Enable the compose key on Linux — I set the "Menu" key to be compose — then the sequence is Compose . =

Characters like →, —, €, £, ©, ™, µ, ①, ②, , °, “ and ”, … and ‽ are easily available, as well as most European-ish letter accents: àáâäąȧåảāãæ.

(I live in Denmark, but rarely type Danish. The compose key is more than adequate for typing København, Østerbro and the Æ in my street's name.)

https://en.wikipedia.org/wiki/Compose_key


• is Option-8 on a Mac.


I personally type it with a unicode keyboard input (ex: Japanese in my case) 

ex: "・"




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: