<?php

require __DIR__ . '/../bootstrap.php';

$em = \EmotionHero\Application::getInstance()->getEm();
$hitRepo = $em->getRepository(\EmotionHero\Models\Hit::class);
$hits = $hitRepo->findBy([], ['sadness'=>'ASC']);

?>
<html>
    <head>
        <title>Emotion Hero</title>
    </head>
    <style type="text/css">
        body{
            background:yellow;
        }
    </style>
    <body>
<?php
/* @var $hit EmotionHero\Models\Hit */
foreach($hits as $hit) {
    $filename = __DIR__ . '/../files/hits/brows/'. $hit->getId() . '.jpg';
    if(!file_exists($filename))
        continue;
    
    $img = file_get_contents($filename);
    $data = base64_encode($img);
    echo "<img src=\"data:image/x-icon;base64,$data\">";
}
?>
    </body>
</html>