Skip to content

Commit

Permalink
Fix bad-looking transparent Discord avatars (#1117)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngyikp authored Nov 14, 2023
1 parent 4d6f554 commit b28fbc3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Discord/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected function formatAvatar(array $user)

$isGif = preg_match('/a_.+/m', $user['avatar']) === 1;
$extension = $this->getConfig('allow_gif_avatars', true) && $isGif ? 'gif' :
$this->getConfig('avatar_default_extension', 'jpg');
$this->getConfig('avatar_default_extension', 'png');

return sprintf('https://cdn.discordapp.com/avatars/%s/%s.%s', $user['id'], $user['avatar'], $extension);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Discord/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Please see the [Base Installation Guide](https://socialiteproviders.com/usage/),

// optional
'allow_gif_avatars' => (bool)env('DISCORD_AVATAR_GIF', true),
'avatar_default_extension' => env('DISCORD_EXTENSION_DEFAULT', 'jpg'), // only pick from jpg, png, webp
'avatar_default_extension' => env('DISCORD_EXTENSION_DEFAULT', 'png'), // only pick from jpg, png, webp
],
```

Expand Down

0 comments on commit b28fbc3

Please sign in to comment.