<?php
function data_uri($file, $mime) {
    $contents = file_get_contents($file);
    $base64 = base64_encode($contents);
    return "data:$mime;base64,$base64";
}
?>
<div align="center">
<img src="<?php echo $DataURL=data_uri('http://www.softafzar.net/customavatars/avatar1_22.gif', 'image/png'); ?>" alt="An elephant">
<p><p>
<input name="" type="text" size="50" value="<?php echo $DataURL?>" />
</div>

Data URI چیست؟