preparation for profile pictures

This commit is contained in:
overflowerror 2021-01-08 13:22:31 +01:00
parent 42d886f1b5
commit 2f27705f02
4 changed files with 22 additions and 2 deletions

BIN
public/images/user.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -6,6 +6,7 @@ namespace App\Controller;
use App\Service\UserService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\Routing\Annotation\Route;
@ -20,6 +21,15 @@ class UserController extends AbstractController
$this->userService = $userService;
}
/**
* @Route("/user/{username}/picture", name="app_user_profile_picture")
*/
public function userProfilePicture($username): Response
{
// placeholder
return new BinaryFileResponse("../public/images/user.png");
}
/**
* @Route("/admin/users", name="app_user_list")
*/

View file

@ -68,10 +68,11 @@
aria-expanded="false"
>
<img
src="https://mdbootstrap.com/img/Photos/Avatars/img (31).jpg"
src="{{ is_granted('ROLE_USER')
? path("app_user_profile_picture", {"username": app.user.username})
: asset("images/user.png") }}"
class="rounded-circle avatar"
alt=""
loading="lazy"
/>
</a>
<ul class="dropdown-menu avatar-dropdown" aria-labelledby="navbarDropdownMenuLink">

View file

@ -12,6 +12,8 @@
<th>
<input type="checkbox">
</th>
<th>
</th>
<th>
Username
</th>
@ -27,6 +29,13 @@
<td>
<input type="checkbox">
</td>
<td>
<img
src="{{ path("app_user_profile_picture", {"username": user.username}) }}"
class="rounded-circle avatar"
alt=""
/>
</td>
<td>
{{ user.name }}
</td>