RFC 2397 – Embed image data inside a URL

Technology

I discovered a URI called “data:” today which allows you to encode any amount of file data into a URL. This data could be an image, ascii text, xml data, you name it. You’ll have to read the details, but you use it like this:
data:image/jpeg;base64,base_64_encoded_jpeg_goes_here

The RFC was drafted in 1998, so it’s by no means new. It was news to me, though, and it’s got me thinking of all sorts of interesting applications, especially since it appears to be implemented in standard browsers. Some things that you might be able to do with this include:

  • javascript based image editor
  • storage of attachments within a web page or blog entry (simplify file hosting)
  • post images or files to forums that allow url posting
  • sneak attachments past grumpy email filters

Anyway, those are just some initial ideas. You probably have better ones, so let us know in the comments.

Me, encoded in a data URL – Link.
RFC 2397 – Link.
Convert a URL or uploaded photo to a data: URI – Link.

Discuss this article with the rest of the community on our Discord server!
Tagged

ADVERTISEMENT

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 16th iteration!

Prices Increase in....

Days
Hours
Minutes
Seconds
FEEDBACK