Data URI

 

Data URI's allow binary data (e.g. an image file) to be stored as plain text. The mechanism to convert binary to text is Base 64 encoding.

Wimpy uses Data URI's to store images within skin files and playlists -- thereby eliminating the need for external file resources.

The Gorey Details

Data URI's take the form of a string that starts with "data:" followed by a quassi-header followed by the payload data. The quassi-header provides general information about the payload. The header and payload are seperated by a comma.

data:header,payload

The header includes the mime-type and the encoding type. with each portion seperated by a semicolon:

image/jpeg;base64

The payload is, well, Base 64 encoded image data. Base 64 encoded data needs to have the total number of characters divisible by 4. The tail end of the Base 64 data may have equals signs. The equal signs are simply padding to ensure % 4.

Putting them altogether would result in somethign similar to:

data:image/jpeg;base64,WICKED_UGLY_TEXT==