Skip to content

Instantly share code, notes, and snippets.

Created July 4, 2015 22:15
What would you like to do?
Create Data URI’s
Data URI’s can be useful for embedding images into HTML/CSS/JS to save on HTTP requests. The following function will create a Data URI based on $file for easier embedding.
function data_uri($file, $mime) {
echo "data:$mime;base64,$base64";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment