In PHP possiamo generare gli URL di dati.
La soluzione รจ la seguente:
function to_data_uri($file, $mime) {
$output = '';
if(file_exists($file)) {
$contents = file_get_contents($file);
$base64 = base64_encode($contents);
$output = "data:$mime;base64,$base64";
}
echo $output;
}