[AVATAR] Fixed avatar upload, added avatar inline download and updated template and base controller

This commit is contained in:
Hugo Sales
2020-08-08 16:10:25 +00:00
committed by Hugo Sales
parent 2bf914f96f
commit bd8f4bd277
13 changed files with 303 additions and 97 deletions

View File

@@ -32,6 +32,8 @@
namespace App\Core;
use App\Core\DB\DB;
use App\Util\Common;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
@@ -60,7 +62,13 @@ class Controller extends AbstractController implements EventSubscriberInterface
$controller = $event->getController();
$request = $event->getRequest();
$this->vars = ['controler' => $controller, 'request' => $request];
if (($avatar = DB::find('avatar', ['profile_id' => Common::profile()->getId()])) != null) {
$avatar_filename = $avatar->getUrl();
} else {
$avatar_filename = '/public/assets/default_avatar.svg';
}
$this->vars = ['controler' => $controller, 'request' => $request, 'user_avatar' => $avatar_filename];
Event::handle('StartTwigPopulateVars', [&$this->vars]);
return $event;