Image Data URIs with PHP

I often Use Image Data URIs for large-scale applications depending on client requirement(not supported in IE7 and below).

Data URI: The data URI scheme is a URI scheme that provides a way to include data in-line in web pages as if they were external resources. This technique allows normally separate elements such as images and style sheets to be fetched in a single HTTP request rather than multiple HTTP requests, which can be more efficient.

Advantages of DATA URIs:
1.We can reduce the number of request to the network
2.we can Hide the file structure

NOTE: IE7 and Below versions didn’t support data URIs.

Here is the Code :

mime_content_type is depreciated, we can get the same output with FileInfo. let me show you

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

Arjun
I am Arjun from Hyderabad (India). I have been working as a software engineer from last 7+ years, and its my passion to learn new things and implement them as a practice. Aside from work, I likes gardening and spending time with pets.
DMCA.com Protection Status