victorl.ai

data URL images

Here’s something cool.

VICTOR LAI

So, that looks like any image file, no? Actually, if you look at its source, it’s really just a big line of text. I can’t say I know too much about what’s really behind it, but the line of text is a data URL, developed for the Data URI scheme (Uniform Resource Identifier scheme), which according to Wikipedia, was made specifically for embedding images in a single file, rather than using conventional external images.

Reading a bit more, a uniform resource identifier is a string of characters that identifies a name or resource. So a filepath will do, but also the Data URL, which breaks the resource data into a base64-encoded string.

Using dataurl.net, you can convert most images to get a Data URL, which you can then link to in your HTML file via

<img src="data:url" />

It’s a pretty nifty little piece of code.

In other news, the new site is up and running. I think it’s a bit better than before.

This site is maintained by blisse