Understand the Data URIs
Data URI is a new URI ( Uniform Resource Locator ) format, which allows small files to be embedded inlined in an HTML document. This doesn't require any absolute or relative path to the resource which is physically placed on the server. URLs prefixed with
data: allows embed small files in the document.
Data URI Format
Data URIs is the composition of :
data: which indicates the MIME type, the type of data
base64 token if data is non-textual
3. The data itself
Data URIs syntax looks like
Why use Data URIs?
Main benefit of using Data URI is, Saving of http requests which is subject to the speed performance of the website.
How to use Data URIs?
So many online tools available on the web to convert files in Data URI format
Data URI conversion in PHP
For php developer there is a small script which returns the Data URI format, which is as follows:
<?php echo base64_encode(file_get_contents("file_path/file_name.extension")) ?>