Skip to content

Instantly share code, notes, and snippets.

@shyamsalimkumar
Last active December 18, 2015 08:09
Show Gist options
  • Save shyamsalimkumar/5752394 to your computer and use it in GitHub Desktop.
Save shyamsalimkumar/5752394 to your computer and use it in GitHub Desktop.
PHP - Create data uri’s - Base64 encoding
function data_uri($file, $mime) {
$contents=file_get_contents($file);
$base64=base64_encode($contents);
return "data:$mime;base64,$base64";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment