fix avatar

This commit is contained in:
Yuri Kuznetsov
2022-10-04 08:52:40 +03:00
parent 73dbfa38ec
commit 6d1ab5870f
+5 -1
View File
@@ -75,10 +75,14 @@ class Avatar extends Image implements Di\MetadataAware
$sum += ord($hash[$i]);
}
$x = intval($sum % 128) + 1;
$x = $sum % 128 + 1;
$colorList = $this->metadata->get(['app', 'avatars', 'colorList']) ?? $this->colorList;
if ($x === 128) {
$x--;
}
$index = intval($x * count($colorList) / 128);
return $colorList[$index];