diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-05-28 09:44:10 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-06-13 18:46:05 +0200 |
commit | 156da29ceade106176e2288ef391c4cb2006d800 (patch) | |
tree | 8848a56353907cad3d8f33affcef2381ba600210 /core | |
parent | 4432cfd445d2dea2792c0cc2550445506ba8a18a (diff) | |
download | nextcloud-server-156da29ceade106176e2288ef391c4cb2006d800.tar.gz nextcloud-server-156da29ceade106176e2288ef391c4cb2006d800.zip |
Avatar imagick bump
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/Controller/AvatarController.php | 62 |
1 files changed, 14 insertions, 48 deletions
diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index e5a8e4fe29c..94c837888dc 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -113,22 +113,6 @@ class AvatarController extends Controller { } - - - - /** - * @NoAdminRequired - * @NoCSRFRequired - * @NoSameSiteCookieRequired - * @PublicPage - * - * Shortcut to getAvatar - */ - public function getAvatarPng($userId, $size) { - return $this->getAvatar($userId, $size, true); - } - - /** * @NoAdminRequired * @NoCSRFRequired @@ -137,46 +121,28 @@ class AvatarController extends Controller { * * @param string $userId * @param int $size - * @param bool $png return png or not * @return JSONResponse|FileDisplayResponse */ - public function getAvatar($userId, $size, bool $png = false) { + public function getAvatar($userId, $size) { + // min/max size if ($size > 2048) { $size = 2048; } elseif ($size <= 0) { $size = 64; } - // Serve png as a fallback only - if ($png === false) { - - try { - $avatar = $this->avatarManager->getAvatar($userId)->getAvatarVector($size); - $resp = new DataDisplayResponse( - $avatar, - Http::STATUS_OK, - ['Content-Type' => 'image/svg+xml' - ]); - } catch (\Exception $e) { - $resp = new Http\Response(); - $resp->setStatus(Http::STATUS_NOT_FOUND); - return $resp; - } - - } else { - - try { - $avatar = $this->avatarManager->getAvatar($userId)->getFile($size); - $resp = new FileDisplayResponse( - $avatar, - Http::STATUS_OK, - ['Content-Type' => $avatar->getMimeType() - ]); - } catch (\Exception $e) { - $resp = new Http\Response(); - $resp->setStatus(Http::STATUS_NOT_FOUND); - return $resp; - } + try { + $avatar = $this->avatarManager->getAvatar($userId)->getFile($size); + $resp = new FileDisplayResponse( + $avatar, + Http::STATUS_OK, + ['Content-Type' => $avatar->getMimeType() + ]); + } catch (\Exception $e) { + var_dump($e); + $resp = new Http\Response(); + $resp->setStatus(Http::STATUS_NOT_FOUND); + return $resp; } // Cache for 30 minutes |