Create Data URI’s

<?php function data_uri($file, $mime) { $contents=file_get_contents($file); $base64=base64_encode($contents); echo "data:$mime;base64,$base64"; } ?>
Data URI’s can be useful for embedding images into HTML/CSS/JS to save on HTTP requests and consequently enhance your site loading time. The following function will create a Data URI based on $file for easier embedding.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.