Fix images fixed order

This commit is contained in:
Ruben 2016-11-03 01:12:34 +01:00
parent d9d79447ff
commit cc55dec827
1 changed files with 3 additions and 3 deletions

View File

@ -29,19 +29,19 @@ class InterfaceControllerProvider implements ControllerProviderInterface
$getEmoBlocks = function($emotion, $feature, $steps = 6) {
$hitRepo = $this->_eh->getEm()->getRepository(Models\Hit::class);
$blocks = [];
$a = 1;
$position = 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[$a] = [
$blocks[$position] = [
'hit_id' => $hit->getId(),
'img_data' => $img,
'percentage' => $percentage,
];
$a++;
$position++;
}
return $blocks;
};