Skip to content

Commit

Permalink
workaround for broken openbasedir issue with fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron committed Aug 29, 2024
1 parent 3385cd7 commit 9b3eb06
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
2 changes: 0 additions & 2 deletions .idea/leantime-oss.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 15 additions & 6 deletions app/Domain/Users/Repositories/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Leantime\Domain\Users\Repositories {

use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Log\Logger;
use Illuminate\Support\Facades\Log;
use LasseRafn\InitialAvatarGenerator\InitialAvatar;
use LasseRafn\Initials\Initials;
use Leantime\Core\Configuration\Environment;
Expand Down Expand Up @@ -718,18 +720,25 @@ public function getProfilePicture($id): array|SVG
$stmn->closeCursor();
}

$avatar = (new InitialAvatar())
->fontName("Verdana")
->background('#00a887')
->color("#fff");
try {
$avatar = (new InitialAvatar())
->fontName("Verdana")
->background('#00a887')
->color("#fff");

if (empty($value)) {
return $avatar->name("👻")->generateSvg();
if (empty($value)) {
return $avatar->name("👻")->generateSvg();
}
} catch (\Exception $e) {
Log::error("Could not generate avatar.");
Log::error($e);
return array("filename" => "not_found", "type" => "uploaded");
}

$name = $value['firstname'] . " " . $value['lastname'];

if (empty($value['profileId'])) {

/** @var Initials $initialsClass */
$initialsClass = app()->make(Initials::class);
$initialsClass->name($name);
Expand Down

0 comments on commit 9b3eb06

Please sign in to comment.