getEm();
$hitRepo = $em->getRepository(\EmotionHero\Models\Hit::class);
$currentEmotion = 'anger';
$hits = $hitRepo->findBy([], ["emotions.$currentEmotion"=>'ASC']);
?>
Emotion Hero
getRepository(EmotionHero\Models\Hit::class);
$hit = $hitRepo->getClosestHitWithImage("anger", $i);
$img = $hit->getFeatureImgAsString("brows");
$score = $hit->getEmotions()->getEmotionScore("anger");
$percentage = sprintf("%.4f %%",$score);
echo <<< EOSNIPPET
$percentage
EOSNIPPET;
}
/* @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);
$percentage = sprintf("%.4f %%",$hit->getEmotions()->getEmotionScore($currentEmotion));
echo <<< EOSNIPPET
$percentage
EOSNIPPET;
}
?>