diff --git a/src/app/controller/module/profile.php b/src/app/controller/module/profile.php index a84364c..9300539 100644 --- a/src/app/controller/module/profile.php +++ b/src/app/controller/module/profile.php @@ -19,6 +19,11 @@ public function render() $comments = $this->_user->findUserPageCommentsDistinctTotal(); $editions = $this->_user->findUserPageEditionsDistinctTotal(); + $identicon = $this->_user->getIdenticon(24); + + $public = $this->_user->getPublic(); + $address = $this->_user->getAddress(); + include __DIR__ . '../../../view/theme/default/module/profile.phtml'; } } \ No newline at end of file diff --git a/src/app/controller/user.php b/src/app/controller/user.php index ba58cdb..0f6b883 100644 --- a/src/app/controller/user.php +++ b/src/app/controller/user.php @@ -100,11 +100,36 @@ private function _response(string $title, string $h1, string $text, int $code = exit; } + public function getIdenticon(int $size) + { + $icon = new Jdenticon\Identicon(); + + $icon->setValue($this->_user->public ? $this->_user->address : $this->_user->userId); + $icon->setSize($size); + $icon->setStyle( + [ + 'backgroundColor' => 'rgba(255, 255, 255, 0)', + ] + ); + + return $icon->getImageDataUri('webp'); + } + public function getUser() { return $this->_user; } + public function getPublic() + { + return $this->_user->public; + } + + public function getAddress() + { + return $this->_user->address; + } + public function findUserPageStarsDistinctTotalByValue(bool $value) : int { return $this->_database->findUserPageStarsDistinctTotal( diff --git a/src/app/view/theme/default/module/profile.phtml b/src/app/view/theme/default/module/profile.phtml index b102482..42c70dc 100644 --- a/src/app/view/theme/default/module/profile.phtml +++ b/src/app/view/theme/default/module/profile.phtml @@ -1,4 +1,11 @@ -