mirror of
https://github.com/tiennm99/coolify.git
synced 2026-08-20 10:23:30 +00:00
Users can upload and remove profile pictures on the profile page. Admins choose local or instance S3 storage in advanced settings. Avatars are compressed to JPEG and served via a private cached route.
21 lines
510 B
PHP
21 lines
510 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Services\AvatarStorageService;
|
|
use Illuminate\Http\Response;
|
|
|
|
class ProfileAvatarController extends Controller
|
|
{
|
|
public function __invoke(AvatarStorageService $avatarStorage): Response
|
|
{
|
|
$contents = $avatarStorage->contents(auth()->user());
|
|
abort_if($contents === null, 404);
|
|
|
|
return response($contents, 200, [
|
|
'Content-Type' => 'image/jpeg',
|
|
'Cache-Control' => 'private, max-age=300',
|
|
]);
|
|
}
|
|
}
|