BookStack
BookStack copied to clipboard
AVATAR_URL parameter in .env not working as expected
Attempted Debugging
- [X] I have read the debugging page
Searched GitHub Issues
- [X] I have searched GitHub for the issue.
Describe the Scenario
Hello, I am attempting to get bookstack to pull profile pictures from an internal service. I have set the AVATAR_URL to the internal service and included the necessary placeholders but new users are still getting the default image, even after refreshing images through the CLI. Here is the relevant line from my .env:
AVATAR_URL='https://domain.com/cdn/images/bymail.php?id=${email}&w=256&h=256'
I have tried various sizes, and even using HTTP rather than HTTPS. The way that that script works is that it determines the username, domain, and requested size it was given and then redirects to the appropriate image (images are in JPG format).
Any help is much appreciated. Thank you!
Exact BookStack Version
v23.12
Log Content
[2024-01-18 11:03:52] production.ERROR: Failed to save user avatar image {"exception":"[object] (BookStack\Exceptions\HttpFetchException(code: 0): Cannot get image from https://domain.com/cdn/images/bymail.php?id=user%40domain.com&w=256&h=256 at C:\inetpub\wwwroot\docs\app\Uploads\UserAvatars.php:118) [stacktrace] #0 C:\inetpub\wwwroot\docs\app\Uploads\UserAvatars.php(87): BookStack\Uploads\UserAvatars->getAvatarImageData() #1 C:\inetpub\wwwroot\docs\app\Uploads\UserAvatars.php(33): BookStack\Uploads\UserAvatars->saveAvatarImage() #2 C:\inetpub\wwwroot\docs\app\Console\Commands\RefreshAvatarCommand.php(110): BookStack\Uploads\UserAvatars->fetchAndAssignToUser() #3 C:\inetpub\wwwroot\docs\app\Console\Commands\RefreshAvatarCommand.php(89): BookStack\Console\Commands\RefreshAvatarCommand->fetchAvatar() #4 C:\inetpub\wwwroot\docs\app\Console\Commands\RefreshAvatarCommand.php(50): BookStack\Console\Commands\RefreshAvatarCommand->processUsers() #5 C:\inetpub\wwwroot\docs\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(36): BookStack\Console\Commands\RefreshAvatarCommand->handle() #6 C:\inetpub\wwwroot\docs\vendor\laravel\framework\src\Illuminate\Container\Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #7 C:\inetpub\wwwroot\docs\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure() #8 C:\inetpub\wwwroot\docs\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod() #9 C:\inetpub\wwwroot\docs\vendor\laravel\framework\src\Illuminate\Container\Container.php(661): Illuminate\Container\BoundMethod::call() #10 C:\inetpub\wwwroot\docs\vendor\laravel\framework\src\Illuminate\Console\Command.php(183): Illuminate\Container\Container->call() #11 C:\inetpub\wwwroot\docs\vendor\symfony\console\Command\Command.php(291): Illuminate\Console\Command->execute() #12 C:\inetpub\wwwroot\docs\vendor\laravel\framework\src\Illuminate\Console\Command.php(153): Symfony\Component\Console\Command\Command->run() #13 C:\inetpub\wwwroot\docs\vendor\symfony\console\Application.php(1014): Illuminate\Console\Command->run() #14 C:\inetpub\wwwroot\docs\vendor\symfony\console\Application.php(301): Symfony\Component\Console\Application->doRunCommand() #15 C:\inetpub\wwwroot\docs\vendor\symfony\console\Application.php(171): Symfony\Component\Console\Application->doRun() #16 C:\inetpub\wwwroot\docs\vendor\laravel\framework\src\Illuminate\Console\Application.php(102): Symfony\Component\Console\Application->run() #17 C:\inetpub\wwwroot\docs\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(155): Illuminate\Console\Application->run() #18 C:\inetpub\wwwroot\docs\artisan(37): Illuminate\Foundation\Console\Kernel->handle() #19 {main} "}
Hosting Environment
PHP 8.1.12 on IIS 10, Windows Server 2019
Hi @michaelredus,
Sorry for the late response.
If you trying going to that https://domain.com/cdn/images/bymail.php?id=user%40domain.com&w=256&h=256, as shown in your logs, from your BookStack host machine does that display any errors?
On the host machine, what's the output of running (replacing the URL with that actually shown in your logs):
php -r 'echo substr(base64_encode(file_get_contents("https://domain.com/cdn/images/bymail.php?id=user%40domain.com&w=256&h=256")), 0, 20);'
Since there's been no further follow-up, I'll go ahead and close this off.