system avatar color

This commit is contained in:
yuri
2016-04-25 17:45:57 +03:00
parent 3fd34fc48d
commit 5ae64989eb
+14 -5
View File
@@ -40,7 +40,9 @@ class Avatar extends Image
public static $notStrictAuth = true;
private $colorList = [
protected $systemColor = [212,114,155];
protected $colorList = [
[111,168,214],
[237,197,85],
[212,114,155],
@@ -73,7 +75,6 @@ class Avatar extends Image
$userId = $_GET['id'];
$user = $this->getEntityManager()->getEntity('User', $userId);
if (!$user) {
throw new NotFound();
@@ -103,12 +104,20 @@ class Avatar extends Image
if (!empty($this->imageSizes[$size])) {
$width = $this->imageSizes[$size][0];
ob_clean();
flush();
header('Cache-Control: max-age=360000, must-revalidate');
header('Content-Type: image/png');
ob_clean();
flush();
echo $identicon->getImageData($userId, $width, $this->getColor($userId));
$hash = $userId;
$color = $this->getColor($userId);
if ($hash === 'system') {
$color = $this->systemColor;
}
$imgContent = $identicon->getImageData($hash, $width, $color);
echo $imgContent;
exit;
}
}