diff options
author | Christopher Ng <chrng8@gmail.com> | 2022-07-30 00:32:16 +0000 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2022-09-02 02:22:57 +0000 |
commit | f44d2586b174991002d210efa9568e0b96d92304 (patch) | |
tree | 66ad3d1781cf45fc5a04a3c6303c1d31905aeb1b /core/Controller | |
parent | f167fe0ceb7179ef8ae705bb47c44e596196b5d8 (diff) | |
download | nextcloud-server-f44d2586b174991002d210efa9568e0b96d92304.tar.gz nextcloud-server-f44d2586b174991002d210efa9568e0b96d92304.zip |
Remake profile picture saving with Vue
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'core/Controller')
-rw-r--r-- | core/Controller/AvatarController.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index 2ef219af498..5fcd2a9abbe 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -215,6 +215,19 @@ class AvatarController extends Controller { ); } + if ($image->width() === $image->height()) { + try { + $avatar = $this->avatarManager->getAvatar($this->userId); + $avatar->set($image); + // Clean up + $this->cache->remove('tmpAvatar'); + return new JSONResponse(['status' => 'success']); + } catch (\Throwable $e) { + $this->logger->error($e->getMessage(), ['exception' => $e, 'app' => 'core']); + return new JSONResponse(['data' => ['message' => $this->l->t('An error occurred. Please contact your admin.')]], Http::STATUS_BAD_REQUEST); + } + } + $this->cache->set('tmpAvatar', $image->data(), 7200); return new JSONResponse( ['data' => 'notsquare'], |