query('profileImage', $id) ?? 'false'; if ($id === 'me') { $id = session('userdata.id'); } return new ImageResponse($this->userService->getProfilePicture($id)); } /** * POST — uploads a new profile photo for the current user. * * The target is always the session user; a client-supplied id is never trusted. */ public function upload(): Response { if (! isset($_FILES['file'])) { return response()->json(['error' => 'File not included'], 400); } $_FILES['file']['name'] = 'userPicture.png'; $this->userService->setProfilePicture($_FILES, session('userdata.id')); session(['msg' => 'PICTURE_CHANGED']); session(['msgT' => 'success']); return response()->json(['status' => 'ok']); } }