From e51c66e7d73bd43b864c20da150f24023ed3e626 Mon Sep 17 00:00:00 2001 From: Nathanael Date: Wed, 24 Apr 2024 15:19:33 +0200 Subject: [PATCH 1/2] stream default avatar and bg to client --- LICENSE.md | 13 ++++++++++++ public/data/user/default_avatar_male.png | Bin 0 -> 4735 bytes public/data/user/default_bg.jpg | Bin 0 -> 18665 bytes src/Controller/UserController.php | 24 +++++++++++++++++++++++ 4 files changed, 37 insertions(+) create mode 100644 LICENSE.md create mode 100644 public/data/user/default_avatar_male.png create mode 100644 public/data/user/default_bg.jpg diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..a3ea901 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,13 @@ +# Default Avatar Images + +Image by juicy_fish on Freepik + +# NKCS CRM API License + +Copyright (c) 2023-present Nathanael Kammermann + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/public/data/user/default_avatar_male.png b/public/data/user/default_avatar_male.png new file mode 100644 index 0000000000000000000000000000000000000000..c78fc2480ed4d2ebb3ad4d72177631df86b2bb5c GIT binary patch literal 4735 zcmV-_5`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i!fAGKSY}U6OYJD6_5OB7iD$Y&EP@W!M+#_}}x0 z9%<Rlj9mgnlQfbM1{Uv`@kqs_mPAho&5R5)P@&NtY~R&^^2Iq1yz_^ z5p>IrkqWparT4rySZ!oC$$m1&SOUZDmSPBvu+i(;{;-t%;IN~kzvn87j<@3;72-Uy zI)*rneR{>A7MF|v0L+qx{!6+qpS^b=sevtDn}@)Rjc4(V3MpKV8vGeC5Eq0$De-`8 zx|5x`9>DeI-ms>n+JEnyb$UBFkOZS+#~tJ*HUZnlF0W4J{{SnXcAm5zPrb}IZ{gTf z^W}5fw@?JJ?d59UFWwlp&<*b-sOU!XzupKNrqOllFOIrJpI)-hIAK9rWiV$>olRjy IcKn(D*=4CG_W%F@ literal 0 HcmV?d00001 diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 409447a..715826a 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -13,6 +13,11 @@ #[Route('/api/user')] class UserController extends AbstractApiController { + public function __construct( + private string $documentBaseDir, + ) { + } + #[Route('/')] public function getUserInfo( ClientNavigation $clientNavigation, @@ -22,8 +27,26 @@ public function getUserInfo( $userNavigation = $clientNavigation->getUserClientNavigation($me); + // todo: make this optional by system_setting + $userAvatar = ''; + if (file_exists($this->documentBaseDir . '/user/default_avatar_male.png')) { + $userAvatar = base64_encode(file_get_contents( + $this->documentBaseDir . '/user/default_avatar_male.png' + )); + } + + // todo: make this optional by system_setting + $userAvatarBg = ''; + if (file_exists($this->documentBaseDir . '/user/default_bg.jpg')) { + $userAvatarBg = base64_encode(file_get_contents( + $this->documentBaseDir . '/user/default_bg.jpg' + )); + } + $userApiData = [ 'user' => [ + 'avatar' => $userAvatar, + 'background' => $userAvatarBg, 'name' => $me->getName(), 'firstName' => $me->getFirstName(), 'function' => $me->getFunction(), @@ -63,6 +86,7 @@ public function getUserInfo( ]; } } + return $this->json($userApiData); } From 29b5c08cbf06c52fced36e0f35ca195d15c808e5 Mon Sep 17 00:00:00 2001 From: Nathanael Date: Wed, 24 Apr 2024 16:26:13 +0200 Subject: [PATCH 2/2] stream default avatar and bg to client --- src/Controller/UserController.php | 84 ++++++++++++++++++++++++++++--- src/Dto/Base64FileRequest.php | 36 +++++++++++++ 2 files changed, 114 insertions(+), 6 deletions(-) create mode 100644 src/Dto/Base64FileRequest.php diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 715826a..d46f3e8 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -2,10 +2,12 @@ namespace App\Controller; +use App\Dto\Base64FileRequest; use App\Repository\SystemSettingRepository; use App\Service\User\ClientNavigation; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Attribute\MapRequestPayload; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\Routing\Annotation\Route; use Symfony\Contracts\HttpClient\HttpClientInterface; @@ -29,18 +31,30 @@ public function getUserInfo( // todo: make this optional by system_setting $userAvatar = ''; - if (file_exists($this->documentBaseDir . '/user/default_avatar_male.png')) { - $userAvatar = base64_encode(file_get_contents( - $this->documentBaseDir . '/user/default_avatar_male.png' + if (file_exists($this->documentBaseDir . '/user/' . $this->getUser()->getId() . '_avatar.png')) { + $userAvatar = base64_encode(file_get_contents( + $this->documentBaseDir . '/user/' . $this->getUser()->getId() . '_avatar.png' )); + } else { + if (file_exists($this->documentBaseDir . '/user/default_avatar_male.png')) { + $userAvatar = base64_encode(file_get_contents( + $this->documentBaseDir . '/user/default_avatar_male.png' + )); + } } // todo: make this optional by system_setting $userAvatarBg = ''; - if (file_exists($this->documentBaseDir . '/user/default_bg.jpg')) { - $userAvatarBg = base64_encode(file_get_contents( - $this->documentBaseDir . '/user/default_bg.jpg' + if (file_exists($this->documentBaseDir . '/user/' . $this->getUser()->getId() . '_background.jpg')) { + $userAvatarBg = base64_encode(file_get_contents( + $this->documentBaseDir . '/user/' . $this->getUser()->getId() . '_background.jpg' )); + } else { + if (file_exists($this->documentBaseDir . '/user/default_bg.jpg')) { + $userAvatarBg = base64_encode(file_get_contents( + $this->documentBaseDir . '/user/default_bg.jpg' + )); + } } $userApiData = [ @@ -102,4 +116,62 @@ public function referralInfo( . $this->getParameter('license.holder') )->getContent())); } + + #[Route( + path: '/avatar', + methods: ['POST'] + )] + public function uploadAvatar( + #[MapRequestPayload] Base64FileRequest $base64FileRequest, + ): Response { + $templateContent = base64_decode($base64FileRequest->getFile()); + $templateSavePath = $this->documentBaseDir . '/user/' . $this->getUser()->getId() . '_avatar.png'; + file_put_contents($templateSavePath, $templateContent); + + $userAvatar = ''; + if (file_exists($templateSavePath)) { + $userAvatar = base64_encode(file_get_contents( + $templateSavePath + )); + } else { + if (file_exists($this->documentBaseDir . '/user/default_avatar_male.png')) { + $userAvatar = base64_encode(file_get_contents( + $this->documentBaseDir . '/user/default_avatar_male.png' + )); + } + } + + return $this->json([ + 'avatar' => $userAvatar + ]); + } + + #[Route( + path: '/background', + methods: ['POST'] + )] + public function uploadBackground( + #[MapRequestPayload] Base64FileRequest $base64FileRequest, + ): Response { + $templateContent = base64_decode($base64FileRequest->getFile()); + $templateSavePath = $this->documentBaseDir . '/user/' . $this->getUser()->getId() . '_background.jpg'; + file_put_contents($templateSavePath, $templateContent); + + $userBackground = ''; + if (file_exists($templateSavePath)) { + $userBackground = base64_encode(file_get_contents( + $templateSavePath + )); + } else { + if (file_exists($this->documentBaseDir . '/user/default_bg.jpg')) { + $userBackground = base64_encode(file_get_contents( + $this->documentBaseDir . '/user/default_bg.jpg' + )); + } + } + + return $this->json([ + 'background' => $userBackground + ]); + } } \ No newline at end of file diff --git a/src/Dto/Base64FileRequest.php b/src/Dto/Base64FileRequest.php new file mode 100644 index 0000000..48f0089 --- /dev/null +++ b/src/Dto/Base64FileRequest.php @@ -0,0 +1,36 @@ +file; + } + + public function getName(): string + { + return $this->name; + } + + public function getExtension(): string + { + return $this->extension; + } + + public function getMimeType(): string + { + return $this->mimeType; + } +} \ No newline at end of file