handle cases where user doesn't exit/doesn't have a profile pic

This commit is contained in:
Thomas Rubini 2023-01-23 20:42:44 +01:00
parent 5986083c3d
commit ba9b1439b5
No known key found for this signature in database
GPG Key ID: C7D287C8C1CAC373
2 changed files with 10 additions and 2 deletions

View File

@ -188,9 +188,17 @@ final class UserController
$O_userModel = new UserModel();
$A_user = $O_userModel->getUserByID($A_urlParams[0]);
header("Content-Type: image/png");
if (!isset($A_user)) {
die();
}
header("Content-Type: image/png");
if ($A_user["PROFILE_PIC"] === null) {
echo file_get_contents(Constants::rootDir()."/static/img/generic_user.jpg");
} else {
echo $A_user["PROFILE_PIC"];
}
return Utils::RETURN_RAW;
}

View File

Before

Width:  |  Height:  |  Size: 452 KiB

After

Width:  |  Height:  |  Size: 452 KiB