Fix images fixed order
This commit is contained in:
parent
c975392069
commit
d9d79447ff
1 changed files with 3 additions and 1 deletions
|
@ -29,17 +29,19 @@ class InterfaceControllerProvider implements ControllerProviderInterface
|
|||
$getEmoBlocks = function($emotion, $feature, $steps = 6) {
|
||||
$hitRepo = $this->_eh->getEm()->getRepository(Models\Hit::class);
|
||||
$blocks = [];
|
||||
$a = 1;
|
||||
foreach(range(0, 100, 100/($steps-1)) as $i) {
|
||||
/* @var $hitRepo EmotionHero\Models\HitRepository */
|
||||
$hit = $hitRepo->getClosestHitWithImage($emotion, $i);
|
||||
$img = "data:image/x-icon;base64,".$hit->getFeatureImgAsString($feature);
|
||||
$score = $hit->getEmotions()->getEmotionScore($emotion);
|
||||
$percentage = sprintf("%.0f %%",$score);
|
||||
$blocks[$i] = [
|
||||
$blocks[$a] = [
|
||||
'hit_id' => $hit->getId(),
|
||||
'img_data' => $img,
|
||||
'percentage' => $percentage,
|
||||
];
|
||||
$a++;
|
||||
}
|
||||
return $blocks;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue