<?php
    
if ($_REQUEST['show'] == 'source') {
        
highlight_file('index.php');
        exit;
    }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Tests du schéma data</title>
</head>
<body>

<?php
    
// On crée une image (disque noir sur fond rouge)
    
$im imagecreatetruecolor(2020);
    
$red imagecolorallocate($im25500);
    
$black imagecolorallocate($im000);
    
imagefill($im00$red);
    
imagefilledellipse($im10101010$black);

    
// On bufferise la sortie pour récupérer l'image
    // dans une chaîne au lieu de l'envoyer dans un
    // fichier ou vers la sortie standard
    
ob_start();
    
imagejpeg($im);
    
$im_str ob_get_contents();

    
// Fin de bufferisation et destruction de l'image
    
ob_end_clean();
    
imagedestroy($im);

    
// Maintenant on encode l'image en base64
    
$im_b64 base64_encode($im_str);

    
// Ceci pour améliorer la présentation
    
$chunks "\n\t" chunk_split($im_b6460"\n\t");
?>

<p>
<img alt="" src="data:image/jpeg;base64,<?php echo $chunks?>">
</p>

</body>
</html>