Created
December 2, 2013 12:56
-
-
Save gr8pathik/7749064 to your computer and use it in GitHub Desktop.
Create Data URI’s using PHP - Source: http://css-tricks.com/snippets/php/create-data-uris/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function data_uri($file, $mime) { | |
$contents=file_get_contents($file); | |
$base64=base64_encode($contents); | |
echo "data:$mime;base64,$base64"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment