A simple function which will allow you to base64 encode images on the fly.
$imgType = end(explode(".", trim($imgPath)));
$imgType = strtolower($imgType);
$img = file_get_contents($imgPath);
$img = base64_encode($img);
<img src="<?php echo getBase64Image('./mini.jpg') ?>" alt="">
Why would I want to do this? simply put by doing this the browser has to make one less network connection. Which in tern will speed up your website.
On Mobile, Data URIs are 6x Slower than Source Linking (New Research)