getEm(); $hitRepo = $em->getRepository(\EmotionHero\Models\Hit::class); /* @var $currentHit \EmotionHero\Models\Hit */ $currentHit = $hitRepo->findOneBy(['hasImage'=>true], ['id'=>'DESC']); $printEmoBlocks = function($emotion, $feature, $steps = 6) use($em) { foreach(range(0, 100, 100/($steps-1)) as $i) { /* @var $hitRepo EmotionHero\Models\HitRepository */ $hitRepo = $em->getRepository(EmotionHero\Models\Hit::class); $hit = $hitRepo->getClosestHitWithImage($emotion, $i); $img = $hit->getFeatureImgAsString($feature); $score = $hit->getEmotions()->getEmotionScore($emotion); $percentage = sprintf("%.0f %%",$score); echo <<< EOSNIPPET
$percentage
EOSNIPPET; } }; ?> Emotion Hero "; echo "getFeatureImgAsString("brows")}\" title=\"{$currentHit->getId()}\">"; echo "
"; foreach(EmotionHero\Models\Emotions::$EMOTIONS as $emotion) { echo "
$emotion
" . sprintf("%.2f %%", $currentHit->getEmotions()->getEmotionScore($emotion)) . "
"; } echo "
"; echo ""; echo "

eye brows

"; echo "
anger
"; $printEmoBlocks('anger','brows'); echo "getFeatureImgAsString("brows")}\" title=\"{$currentHit->getId()}\" style=\"top:{$currentHit->getEmotions()->getAnger()}%\">"; echo "
"; echo "
joy
"; $printEmoBlocks('joy','brows'); echo "getFeatureImgAsString("brows")}\" title=\"{$currentHit->getId()}\" style=\"top:{$currentHit->getEmotions()->getJoy()}%\">"; echo "
"; echo "
sadness
"; $printEmoBlocks('sadness','brows'); echo "getFeatureImgAsString("brows")}\" title=\"{$currentHit->getId()}\" style=\"top:{$currentHit->getEmotions()->getSadness()}%\">"; echo "
"; echo "
surprise
"; $printEmoBlocks('surprise','brows'); echo "getFeatureImgAsString("brows")}\" title=\"{$currentHit->getId()}\" style=\"top:{$currentHit->getEmotions()->getSurprise()}%\">"; echo "
"; echo "
"; // .brows echo "

nose

"; echo "
anger"; $printEmoBlocks('joy','nose'); echo "
"; echo "
joy"; $printEmoBlocks('disgust','nose'); echo "
"; echo "
sadness"; $printEmoBlocks('sadness','nose'); echo "
"; echo "
"; // .nose $circles = ""; foreach($currentHit->getPoints()->getNormalisedPoints() as $i => $point) { $circles .= ''; } echo <<< EOSVG $circles EOSVG; ?>