diff --git a/app/config/cloud/contributors.json b/app/config/cloud/contributors.json new file mode 100644 index 0000000000..efa36c3cb2 --- /dev/null +++ b/app/config/cloud/contributors.json @@ -0,0 +1 @@ +[1297371,1759475,6360216,20852629,5857008,19310830,9708641,26739219,23742426,22174310,77877486,1477010,29069505,62933155,45863583,42211,176163,58045728,7091609,31401437,1911066,66096031,22432834,43054051,79051850,22895284,100597998,91385411,49699333,7818620,11004008,54898623,27856297,33250853,49375670,30630364,50206,47822499,7481165,52557347,13681567,20492520,51369094,51821861,50256986,28431370,13692220,24373771,15938422,27148250,14805534,36137226,36071208,40193621,56179878,53281158,48085134,19358691,32528768,19733683,37348419,13719696,18309412,42106787,53618500,5306011,4408379,35486736,18586611,15062564,27011453,56090587,44623032,25107942,81188,33922418,16717633,32809211,69401139,25815659,4104127,20889958,3102249,12476526,2635185,28495651,50957556,2791280,31023616,20955511,835733,471907,69008866,44906587,45271396,76054330,45748739,41908747,23402178,47356149,8921,36632821,3668741,71702982,29725587,26303198,785830,51410502,60089135,2847349,43172716,48546075,8216525,41161981,51828039,4334997,80918302,38534289,47860497,80036766,41341387,49818988,58487637,29237374,46913894,5148229,4377199,29686102,26272249,75117692,4090256,27357868,33062368,38664231,46695441,743291,22633385,6368283,11593067,45097959,43381712,3284228,1972717,33012425,61755381,25405707,3144291,44156359,5497267,7423905,20716175,28586681,5975506,23518097,22187384,24191952,7768078,971530,51240166,55633427,34207400,77061285,11719476,35950229,66742927,34406802,802933,50047839,39148877,26602940,9693472,44273767,19362725,31209978,30521594,686298,6237394,35039730,42580581,36671793,8502129,8466918,81866614,54903252,28373606,13381361,72331432,30694270,5355510,8209163,86675510,9453522,42496309,56145786,2149381,393945,22084723,52621436,8872447,5575392,29619660,5547479,8852116,11151445,4717349,17725274,65615065,18537755,29292618,53044263,26597930,10313411,55998629,77529288,17404636,33729848,19422168,17916404,66111735,10329006,33502846,398230,81643826,105039167,47522632,91655303,9774614,10603631,284924,60857954,22885912,116552306,36103454,794606,27729549,1754457,36594527,13899668,78664749,47406531,27698189,5305654,53345517,6756412,29176704,77790497,47504894,37251540,52361778,52200375,1351177,66022861,73975409,25745396,31433638,37118134,43210805,20317665,11923975,47187468,16362381,36751163,14959876,32362757,65529384,52352285,74085816,3628535,43902034,75667593,26132902,466713,617558,96806061,33605526,11290524,43621940,12446314,17146935,55018955,56096559,79797000,40014186,34449936,58387964,23368207,42414965,44056349,33743031,12294525,58251592,33755729,9021747,932084,11428067,97121933,80122730,60894542,58583793,56051809,32243289,9934371,90936802,74638775,65399526,77604,64524822,47782249,43633955,42793632,55969597,72334601,82395440,92818577,60866204,65016769,23725091,45892107,55308895,86314140,82756460,47685349,63562160,73419211,1613216,50882624,91469717,46166258,60927324,41763158,83607556,2171717,50497814,39427312,61322830,40076195,39419448,29397545,55090719,53259730,20885012,64558515,69677883,55741087,72426535,46033036,68477507,30376878,73700530,25518600,29922887,36229969,47573417,40424087,49054503,16880385,22801227,72848513,64347914,814402,49149679,55017867,49481876,67067955,31439735,63878173,80322286,43746210,17332970,22702905,62476876,89888292,75736952,54059881,90782137,63588969,57111920,63330165,70258211,46371923,17837758,59364507,52203828,60147326,18481195,74822422,9803078,67309607,60410049,47360939,19922556,90848252,24698014,58886915,63579762,96648934,68523530,60518745,37345795,3929651,54993657,52061363,43019989,5787917,94674993,71593494,17143469,10288548,1830380,71510505,59124772,2335145,70798495,46474346,49263351,52062536,63151043,65248303,26071571,53626355,43992469,60785452,63467479,71837281,19490891,58628586,38250310,7271718,1110414,57227290,11625672,85063520,88965873,70096901,42029519,85363195,64471630,69353350,66922161,2221746,100430077,12299813,62690310,68282006,99184676,2450,22989561,22212661,59973863,11232940,76688923,22321353,77732479,84286404,32268377,34828782,23068019,57074509,24620969,20735983,26173690,75809937,49760818,86646105,52617262] \ No newline at end of file diff --git a/app/config/cloud/employees.json b/app/config/cloud/employees.json new file mode 100644 index 0000000000..6ae544eb57 --- /dev/null +++ b/app/config/cloud/employees.json @@ -0,0 +1 @@ +["eldad@appwrite.io","christy@appwrite.io","torsten@appwrite.io","damodar@appwrite.io","bradley@appwrite.io","jake@appwrite.io","sara@appwrite.io","matej@appwrite.io","aditya@appwrite.io","wess@appwrite.io","may@appwrite.io","elad@appwrite.io","vincent@appwrite.io","haimantika@appwrite.io","chen@appwrite.io","tessa@appwrite.io","shimon@appwrite.io","shmuel@appwrite.io","arman@appwrite.io","carla@appwrite.io","emma@appwrite.io","dylan@appwrite.io","steven@appwrite.io","jyoti@appwrite.io","jade@appwrite.io","khushboo@appwrite.io","thomas@appwrite.io","holly@appwrite.io","laura@appwrite.io","caio@appwrite.io"] \ No newline at end of file diff --git a/app/config/cloud/heroes.json b/app/config/cloud/heroes.json new file mode 100644 index 0000000000..e2b664f551 --- /dev/null +++ b/app/config/cloud/heroes.json @@ -0,0 +1 @@ +["kinmount_turonian@rnlay.com","chlorofluorocarbons_vahan@rnlay.com","emilia@emilia.codes","codewithsimon@gmail.com","a.stephensimon@outlook.com","lucasaudart@gmail.com","bishwajeet.techmaster@gmail.com","alves.mckl@gmail.com","hidianapham@gmail.com","tkarmakar27112000@gmail.com"] \ No newline at end of file diff --git a/app/controllers/api/avatars.php b/app/controllers/api/avatars.php index b387c5d25b..9c56be5e2b 100644 --- a/app/controllers/api/avatars.php +++ b/app/controllers/api/avatars.php @@ -11,6 +11,8 @@ use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; +use Utopia\Database\Validator\Authorization; +use Utopia\Database\Validator\UID; use Utopia\Image\Image; use Utopia\Validator\Boolean; use Utopia\Validator\HexColor; @@ -55,6 +57,55 @@ $avatarCallback = function (string $type, string $code, int $width, int $height, unset($image); }; +$getUserGitHub = function (Document $user, Document $project, Database $dbForProject) { + try { + $sessions = $user->getAttribute('sessions', []); + $session = $sessions[0] ?? new Document(); + + $provider = $session->getAttribute('provider'); + $refreshToken = $session->getAttribute('providerRefreshToken'); + + $appId = $project->getAttribute('authProviders', [])[$provider . 'Appid'] ?? ''; + $appSecret = $project->getAttribute('authProviders', [])[$provider . 'Secret'] ?? '{}'; + + $className = 'Appwrite\\Auth\\OAuth2\\' . \ucfirst($provider); + + if (!\class_exists($className)) { + throw new Exception(Exception::PROJECT_PROVIDER_UNSUPPORTED); + } + + $oauth2 = new $className($appId, $appSecret, '', [], []); + + $oauth2->refreshTokens($refreshToken); + + $accessToken = $oauth2->getAccessToken(''); + $refreshToken = $oauth2->getRefreshToken(''); + + $session + ->setAttribute('providerAccessToken', $accessToken) + ->setAttribute('providerRefreshToken', $refreshToken) + ->setAttribute('providerAccessTokenExpiry', DateTime::addSeconds(new \DateTime(), (int)$oauth2->getAccessTokenExpiry(''))); + + $dbForProject->updateDocument('sessions', $session->getId(), $session); + + $dbForProject->deleteCachedDocument('users', $user->getId()); + + $githubUser = $oauth2->getUserSlug($accessToken); + $githubId = $oauth2->getUserID($accessToken); + + return [ + 'name' => $githubUser, + 'id' => $githubId + ]; + } catch (Exception $err) { + \var_dump($err->getMessage()); + \var_dump($err->getTraceAsString()); + \var_dump($err->getLine()); + \var_dump($err->getFile()); + return []; + } +}; + App::get('/v1/avatars/credit-cards/:code') ->desc('Get Credit Card Icon') ->groups(['api', 'avatars']) @@ -419,118 +470,171 @@ App::get('/v1/avatars/initials') ->file($image->getImageBlob()); }); -App::get('/v1/cards/cloud-og') - ->desc('Get Cloud Card') + App::get('/v1/cards/cloud') + ->desc('Get Front Of Cloud Card') ->groups(['api', 'avatars']) ->label('scope', 'avatars.read') // ->label('cache', true) // ->label('cache.resource', 'cards/cloud') ->label('docs', false) ->label('origin', '*') - ->param('width', 0, new Range(0, 4000), 'Resize image card width, Pass an integer between 0 to 4000.', true) - ->param('height', 0, new Range(0, 4000), 'Resize image card height, Pass an integer between 0 to 4000.', true) + ->param('userId', '', new UID(), 'User ID.', true) + ->param('mock', '', new WhiteList(['employee', 'employee-2digit', 'employee-3digit', 'hero', 'contributor', 'normal', 'platinum', 'normal-no-github', 'normal-long']), 'Mocking behaviour.', true) + ->param('width', 0, new Range(0, 1024), 'Resize image card width, Pass an integer between 0 to 1024.', true) + ->param('height', 0, new Range(0, 1024), 'Resize image card height, Pass an integer between 0 to 1024.', true) ->inject('user') ->inject('project') ->inject('dbForProject') + ->inject('dbForConsole') ->inject('response') - ->action(function (int $width, int $height, Document $user, Document $project, Database $dbForProject, Response $response) { - // if ($user->isEmpty()) { - // throw new Exception(Exception::GENERAL_ACCESS_FORBIDDEN); - // } + ->inject('heroes') + ->inject('contributors') + ->inject('employees') + ->action(function (string $userId, string $mock, int $width, int $height, Document $user, Document $project, Database $dbForProject, Database $dbForConsole, Response $response, array $heroes, array $contributors, array $employees) use ($getUserGitHub) { + if (!empty($userId)) { + $user = Authorization::skip(fn () => $dbForConsole->getDocument('users', $userId)); + } - $baseImage = new \Imagick("public/images/cards-cloud-og3.png"); + if ($user->isEmpty() && empty($mock)) { + throw new Exception(Exception::GENERAL_ACCESS_FORBIDDEN); + } - // $name = $user->getAttribute('name', 'Anonymous'); - // $createdAt = new \DateTime($user->getCreatedAt()); - // $memberSince = \strtoupper('Member since ' . $createdAt->format('M') . ' ' . $createdAt->format('d') . ', ' . $createdAt->format('o')); + if(!$mock) { + $name = $user->getAttribute('name', 'Anonymous'); + $email = $user->getAttribute('email', ''); + $createdAt = new \DateTime($user->getCreatedAt()); + + $gitHub = $getUserGitHub($user, $project, $dbForProject); + $githubName = $gitHub['name'] ?? ''; + $githubId = $gitHub['id'] ?? ''; + + $isHero = \in_array($email, $heroes); + $isContributor = \in_array($githubId, $contributors); + $isEmployee = \in_array($email, $employees); + $employeeNumber = $isEmployee ? \array_search($email, $employees) : ''; + + $isPlatinum = false; // TODO: Randomness logic + } else { + $name = $mock === 'normal-long' ? 'Sir First Walter O\'Brian Junior' : 'Walter O\'Brian'; + $createdAt = new \DateTime('now'); + $githubName = $mock === 'normal-no-github' ? '' : ($mock === 'normal-long' ? 'sir-first-walterobrian-junior' : 'walterobrian'); + $isHero = $mock === 'hero'; + $isContributor = $mock === 'contributor'; + $isEmployee = \str_starts_with($mock, 'employee'); + $employeeNumber = match ($mock) { + 'employee' => '1', + 'employee-2digit' => '18', + 'employee-3digit' => '246', + default => '' + }; - // try { - // $sessions = $user->getAttribute('sessions', []); - // $session = $sessions[0] ?? new Document(); + $isPlatinum = $mock === 'platinum'; + } - // $provider = $session->getAttribute('provider'); - // $refreshToken = $session->getAttribute('providerRefreshToken'); + $isGolden = $isEmployee || $isHero || $isContributor; + $isPlatinum = $isGolden ? false : $isPlatinum; + $memberSince = \strtoupper('Member since ' . $createdAt->format('M') . ' ' . $createdAt->format('d') . ', ' . $createdAt->format('o')); - // $appId = $project->getAttribute('authProviders', [])[$provider . 'Appid'] ?? ''; - // $appSecret = $project->getAttribute('authProviders', [])[$provider . 'Secret'] ?? '{}'; + $imagePath = $isGolden ? 'front-golden.png' : ($isPlatinum ? 'front-platinum.png' : 'front.png'); - // $className = 'Appwrite\\Auth\\OAuth2\\' . \ucfirst($provider); + $baseImage = new \Imagick("public/images/cards/cloud/" . $imagePath); - // if (!\class_exists($className)) { - // throw new Exception(Exception::PROJECT_PROVIDER_UNSUPPORTED); - // } + if($isEmployee) { + $image = new Imagick('public/images/cards/cloud/employee.png'); + $image->setGravity(Imagick::GRAVITY_CENTER); + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 820, 50); - // $oauth2 = new $className($appId, $appSecret, '', [], []); + $text = new \ImagickDraw(); + $text->setTextAlignment(Imagick::ALIGN_CENTER); + $text->setFont("public/fonts/Inter-Bold.ttf"); + $text->setFillColor(new \ImagickPixel('#FFFADF')); + $text->setFontSize(\strlen($employeeNumber) <= 2 ? 54 : 48); + $text->setFontWeight(700); + $metricsText = $baseImage->queryFontMetrics($text, $employeeNumber); - // $oauth2->refreshTokens($refreshToken); + $hashtag = new \ImagickDraw(); + $hashtag->setTextAlignment(Imagick::ALIGN_CENTER); + $hashtag->setFont("public/fonts/Inter-Bold.ttf"); + $hashtag->setFillColor(new \ImagickPixel('#FFFADF')); + $hashtag->setFontSize(28); + $hashtag->setFontWeight(700); + $metricsHashtag = $baseImage->queryFontMetrics($hashtag, '#'); - // $accessToken = $oauth2->getAccessToken(''); - // $refreshToken = $oauth2->getRefreshToken(''); + $startX = 900; + $totalWidth = $metricsHashtag['textWidth'] + 12 + $metricsText['textWidth']; - // $session - // ->setAttribute('providerAccessToken', $accessToken) - // ->setAttribute('providerRefreshToken', $refreshToken) - // ->setAttribute('providerAccessTokenExpiry', DateTime::addSeconds(new \DateTime(), (int)$oauth2->getAccessTokenExpiry(''))); + $hashtagX = ($metricsHashtag['textWidth']/2); + $textX = $hashtagX + 12 + ($metricsText['textWidth']/2); + + $hashtagX -= $totalWidth/2; + $textX -= $totalWidth/2; - // $dbForProject->updateDocument('sessions', $session->getId(), $session); + $hashtagX += $startX; + $textX += $startX; - // $dbForProject->deleteCachedDocument('users', $user->getId()); + $baseImage->annotateImage($hashtag, $hashtagX, 150, 0, '#'); + $baseImage->annotateImage($text, $textX, 150, 0, $employeeNumber); + } - // $githubUser = $oauth2->getUserSlug($accessToken); + if($isContributor) { + $image = new Imagick('public/images/cards/cloud/contributor.png'); + $image->setGravity(Imagick::GRAVITY_CENTER); + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 820, 50); + } - // $gitHub = $githubUser; - // } catch (Exception $err) { - // $gitHub = ''; - // \var_dump($err->getMessage()); - // \var_dump($err->getTraceAsString()); - // \var_dump($err->getLine()); - // \var_dump($err->getFile()); - // } + if($isHero) { + $image = new Imagick('public/images/cards/cloud/hero.png'); + $image->setGravity(Imagick::GRAVITY_CENTER); + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 820, 50); + } - // setlocale(LC_ALL, "en_US.utf8"); - // $name = \iconv("utf-8", "ascii//TRANSLIT", $name); - // $memberSince = \iconv("utf-8", "ascii//TRANSLIT", $memberSince); - // $gitHub = \iconv("utf-8", "ascii//TRANSLIT", $gitHub); - - $name = 'Matej Bačo'; - $memberSince = 'Member since 12 Nov 2023'; - $gitHub = 'meldiron'; + setlocale(LC_ALL, "en_US.utf8"); + $name = \iconv("utf-8", "ascii//TRANSLIT", $name); + $memberSince = \iconv("utf-8", "ascii//TRANSLIT", $memberSince); + $githubName = \iconv("utf-8", "ascii//TRANSLIT", $githubName); $text = new \ImagickDraw(); $text->setTextAlignment(Imagick::ALIGN_CENTER); $text->setFont("public/fonts/Poppins-Bold.ttf"); - $text->setFillColor(new ImagickPixel('#FFFFFF')); - $text->setFontSize(58); + $text->setFillColor(new \ImagickPixel('#FFFFFF')); + + if(\strlen($name) > 33) { + $name = \substr($name, 0, 33); + } + + if(\strlen($name) <= 23) { + $text->setFontSize(80); + } else { + $text->setFontSize(54); + } $text->setFontWeight(700); + $baseImage->annotateImage($text, 512, 480, 0, $name); - $text->skewY(20); - $text->skewX(20); - $text->setGravity(Imagick::GRAVITY_CENTER); - $text->annotation(350, 635, $name); + $text = new \ImagickDraw(); + $text->setTextAlignment(Imagick::ALIGN_CENTER); + $text->setFont("public/fonts/Inter-SemiBold.ttf"); + $text->setFillColor(new \ImagickPixel($isGolden || $isPlatinum ? '#FFFFFF' : '#FFB9CC')); + $text->setFontSize(28); + $text->setFontWeight(600); + $text->setTextKerning(1.08); + $baseImage->annotateImage($text, 512, 550, 0, \strtoupper($memberSince)); + if (!empty($githubName)) { + $text = new \ImagickDraw(); + $text->setTextAlignment(Imagick::ALIGN_CENTER); + $text->setFont("public/fonts/Inter-Regular.ttf"); + $text->setFillColor(new \ImagickPixel('#FFFFFF')); + $text->setFontSize(32); + $text->setFontWeight(400); + $metrics = $baseImage->queryFontMetrics($text, $githubName); - $baseImage->drawImage($text); - // $baseImage->annotateImage($text, 550, 535, -8.86, $name); + $baseImage->annotateImage($text, 512 + 20 + 4, 380, 0, $githubName); - // $text = new \ImagickDraw(); - // $text->setTextAlignment(Imagick::ALIGN_CENTER); - // $text->setFont("public/fonts/Inter-Medium.ttf"); - // $text->setFillColor(new ImagickPixel('#FFB9CC')); - // $text->setFontSize(24); - // $text->setFontWeight(500); - // $text->setTextKerning(1.12); - // $baseImage->annotateImage($text, 570, 630, -22.24, $memberSince); - - // $text = new \ImagickDraw(); - // $text->setTextAlignment(Imagick::ALIGN_CENTER); - // $text->setFont("public/fonts/Inter-Regular.ttf"); - // $text->setFillColor(new ImagickPixel('#FFB9CC')); - // $text->setFontSize(26); - // $text->setFontWeight(400); - // $baseImage->annotateImage($text, 805, 380, 64.75, $gitHub); - - // $metrics = $baseImage->queryFontMetrics($text, $gitHub); - // \var_dump($metrics['textWidth']); + $image = new Imagick('public/images/cards/cloud/github.png'); + $image->setGravity(Imagick::GRAVITY_CENTER); + $precisionFix = 5; + $baseImage->compositeImage($image, Imagick::COMPOSITE_OVER, 512 - ($metrics['textWidth'] / 2) - 20 - 4, 380 - ($metrics['textHeight'] - $precisionFix)); + } if (!empty($width) || !empty($height)) { $baseImage->resizeImage($width, $height, Imagick::FILTER_LANCZOS, 1); @@ -541,3 +645,97 @@ App::get('/v1/cards/cloud-og') ->setContentType('image/png') ->file($baseImage->getImageBlob()); }); + + App::get('/v1/cards/cloud-back') + ->desc('Get Back Of Cloud Card') + ->groups(['api', 'avatars']) + ->label('scope', 'avatars.read') + // ->label('cache', true) + // ->label('cache.resource', 'cards/cloud') + ->label('docs', false) + ->label('origin', '*') + ->param('userId', '', new UID(), 'User ID.', true) + ->param('mock', '', new WhiteList(['golden', 'normal', 'platinum']), 'Mocking behaviour.', true) + ->param('width', 0, new Range(0, 1024), 'Resize image card width, Pass an integer between 0 to 1024.', true) + ->param('height', 0, new Range(0, 1024), 'Resize image card height, Pass an integer between 0 to 1024.', true) + ->inject('user') + ->inject('project') + ->inject('dbForProject') + ->inject('dbForConsole') + ->inject('response') + ->inject('heroes') + ->inject('contributors') + ->inject('employees') + ->action(function (string $userId, string $mock, int $width, int $height, Document $user, Document $project, Database $dbForProject, Database $dbForConsole, Response $response, array $heroes, array $contributors, array $employees) use ($getUserGitHub) { + if (!empty($userId)) { + $user = Authorization::skip(fn () => $dbForConsole->getDocument('users', $userId)); + } + + if ($user->isEmpty() && empty($mock)) { + throw new Exception(Exception::GENERAL_ACCESS_FORBIDDEN); + } + + if(!$mock) { + $userId = $user->getId(); + $email = $user->getAttribute('email', ''); + + $gitHub = $getUserGitHub($user, $project, $dbForProject); + $githubId = $gitHub['id'] ?? ''; + + $isHero = \in_array($email, $heroes); + $isContributor = \in_array($githubId, $contributors); + $isEmployee = \in_array($email, $employees); + + $isGolden = $isEmployee || $isHero || $isContributor; + $isPlatinum = false; // TODO: Randomness logic + } else { + $userId = '63e0bcf3c3eb803ba530'; + + $isGolden = $mock === 'golden'; + $isPlatinum = $mock === 'platinum'; + } + + $userId = 'UID ' . $userId; + + $isPlatinum = $isGolden ? false : $isPlatinum; + + $imagePath = $isGolden ? 'back-golden.png' : ($isPlatinum ? 'back-platinum.png' : 'back.png'); + + $baseImage = new \Imagick("public/images/cards/cloud/" . $imagePath); + + setlocale(LC_ALL, "en_US.utf8"); + $userId = \iconv("utf-8", "ascii//TRANSLIT", $userId); + + $text = new \ImagickDraw(); + $text->setTextAlignment(Imagick::ALIGN_CENTER); + $text->setFont("public/fonts/SourceCodePro-Regular.ttf"); + $text->setFillColor(new \ImagickPixel($isGolden ? '#664A1E' : ($isPlatinum ? '#555555' : '#E8E9F0'))); + $text->setFontSize(28); + $text->setFontWeight(400); + $baseImage->annotateImage($text, 512, 600, 0, $userId); + + if (!empty($width) || !empty($height)) { + $baseImage->resizeImage($width, $height, Imagick::FILTER_LANCZOS, 1); + } + + $response + ->addHeader('Expires', \date('D, d M Y H:i:s', \time() + (60 * 60 * 24 * 45)) . ' GMT') // 45 days cache + ->setContentType('image/png') + ->file($baseImage->getImageBlob()); + }); + +// TODO: Uncomment cache flags + +// TODO: 3D: +// $baseImage = new \Imagick("public/images/cards/cloud/front.png"); +// $text = new \ImagickDraw(); +// $text->setTextAlignment(Imagick::ALIGN_CENTER); +// $text->setFont("public/fonts/Poppins-Bold.ttf"); +// $text->setFillColor(new ImagickPixel('#FFFFFF')); +// $text->setFontSize(58); +// $text->setFontWeight(700); +// $text->skewY(20); +// $text->skewX(20); +// $text->setGravity(Imagick::GRAVITY_CENTER); +// $text->annotation(350, 635, $name); +// $baseImage->drawImage($text); \ No newline at end of file diff --git a/app/init.php b/app/init.php index 0463a35de1..f83f69c780 100644 --- a/app/init.php +++ b/app/init.php @@ -1191,3 +1191,21 @@ App::setResource('servers', function () { return $languages; }); + +App::setResource('contributors', function () { + $path = 'app/config/cloud/contributors.json'; + $list = (file_exists($path)) ? json_decode(file_get_contents($path), true) : []; + return $list; +}, []); + +App::setResource('employees', function () { + $path = 'app/config/cloud/employees.json'; + $list = (file_exists($path)) ? json_decode(file_get_contents($path), true) : []; + return $list; +}, []); + +App::setResource('heroes', function () { + $path = 'app/config/cloud/heroes.json'; + $list = (file_exists($path)) ? json_decode(file_get_contents($path), true) : []; + return $list; +}, []); diff --git a/public/fonts/Inter-Bold.ttf b/public/fonts/Inter-Bold.ttf new file mode 100644 index 0000000000..8e82c70d10 Binary files /dev/null and b/public/fonts/Inter-Bold.ttf differ diff --git a/public/fonts/Inter-Medium.ttf b/public/fonts/Inter-Medium.ttf deleted file mode 100644 index b53fb1c4ac..0000000000 Binary files a/public/fonts/Inter-Medium.ttf and /dev/null differ diff --git a/public/fonts/Inter-SemiBold.ttf b/public/fonts/Inter-SemiBold.ttf new file mode 100644 index 0000000000..c6aeeb16a6 Binary files /dev/null and b/public/fonts/Inter-SemiBold.ttf differ diff --git a/public/fonts/SourceCodePro-Regular.ttf b/public/fonts/SourceCodePro-Regular.ttf new file mode 100644 index 0000000000..c37a7b78d0 Binary files /dev/null and b/public/fonts/SourceCodePro-Regular.ttf differ diff --git a/public/images/cards-cloud-og3.png b/public/images/cards-cloud-og3.png deleted file mode 100644 index 793cb5be80..0000000000 Binary files a/public/images/cards-cloud-og3.png and /dev/null differ diff --git a/public/images/cards-cloud.png b/public/images/cards-cloud.png deleted file mode 100644 index 8c3818c6c8..0000000000 Binary files a/public/images/cards-cloud.png and /dev/null differ diff --git a/public/images/cards/cloud/back-golden.png b/public/images/cards/cloud/back-golden.png new file mode 100644 index 0000000000..68f1114c45 Binary files /dev/null and b/public/images/cards/cloud/back-golden.png differ diff --git a/public/images/cards/cloud/back-platinum.png b/public/images/cards/cloud/back-platinum.png new file mode 100644 index 0000000000..cd56d227a2 Binary files /dev/null and b/public/images/cards/cloud/back-platinum.png differ diff --git a/public/images/cards/cloud/back.png b/public/images/cards/cloud/back.png new file mode 100644 index 0000000000..bb8e5b0b29 Binary files /dev/null and b/public/images/cards/cloud/back.png differ diff --git a/public/images/cards/cloud/contributor.png b/public/images/cards/cloud/contributor.png new file mode 100644 index 0000000000..935987979a Binary files /dev/null and b/public/images/cards/cloud/contributor.png differ diff --git a/public/images/cards/cloud/employee.png b/public/images/cards/cloud/employee.png new file mode 100644 index 0000000000..8b454aba30 Binary files /dev/null and b/public/images/cards/cloud/employee.png differ diff --git a/public/images/cards/cloud/front-golden.png b/public/images/cards/cloud/front-golden.png new file mode 100644 index 0000000000..6f7c251de4 Binary files /dev/null and b/public/images/cards/cloud/front-golden.png differ diff --git a/public/images/cards/cloud/front-platinum.png b/public/images/cards/cloud/front-platinum.png new file mode 100644 index 0000000000..0bea38e9f3 Binary files /dev/null and b/public/images/cards/cloud/front-platinum.png differ diff --git a/public/images/cards/cloud/front.png b/public/images/cards/cloud/front.png new file mode 100644 index 0000000000..19dcad74b7 Binary files /dev/null and b/public/images/cards/cloud/front.png differ diff --git a/public/images/cards/cloud/github.png b/public/images/cards/cloud/github.png new file mode 100644 index 0000000000..c05c9b8f32 Binary files /dev/null and b/public/images/cards/cloud/github.png differ diff --git a/public/images/cards/cloud/hero.png b/public/images/cards/cloud/hero.png new file mode 100644 index 0000000000..1f901a3543 Binary files /dev/null and b/public/images/cards/cloud/hero.png differ