diff --git a/application/Espo/EntryPoints/Avatar.php b/application/Espo/EntryPoints/Avatar.php index 50429b5ca4..1ac18f6a34 100644 --- a/application/Espo/EntryPoints/Avatar.php +++ b/application/Espo/EntryPoints/Avatar.php @@ -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; } }