diff --git a/resources/classes/menu.php b/resources/classes/menu.php
index f00d5c4f18..0424c8b690 100644
--- a/resources/classes/menu.php
+++ b/resources/classes/menu.php
@@ -1192,13 +1192,39 @@ if (!class_exists('menu')) {
//header: right
$html .= "
";
//current user
+ $user_graphic = "
";
+ //determine usage of icon or image
+ if ($_SESSION['theme']['body_header_user_image']['boolean'] == true && !empty($_SESSION['user']['contact_uuid']) && is_uuid($_SESSION['user']['contact_uuid'])) {
+ //load if not already in session
+ if (empty($_SESSION['user']['image'])) {
+ $sql = "select attachment_filename, attachment_content from v_contact_attachments where contact_uuid = :contact_uuid and attachment_primary = 1 and attachment_filename is not null and attachment_content is not null";
+ $parameters['contact_uuid'] = $_SESSION['user']['contact_uuid'];
+ $contact_attachment = $this->database->select($sql, $parameters, 'row');
+ if (!empty($contact_attachment) && is_array($contact_attachment)) {
+ $contact_attachment_extension = pathinfo($contact_attachment['attachment_filename'], PATHINFO_EXTENSION);
+ if (in_array($contact_attachment_extension,['jpg','jpeg','png'])) {
+ $_SESSION['user']['image']['filename'] = $contact_attachment['attachment_filename'];
+ $_SESSION['user']['image']['base64'] = $contact_attachment['attachment_content'];
+ $_SESSION['user']['image']['mime'] = mime_content_type($contact_attachment['attachment_filename']);
+ }
+ }
+ unset($sql, $parameters);
+ }
+ if (!empty($_SESSION['user']['image'])) {
+ $user_graphic_size = str_replace(['px','%'], '', ($_SESSION['theme']['body_header_user_image_size']['numeric'] ?? 18));
+ $user_graphic = "
18 ? '-'.(ceil(($user_graphic_size - 18) / 2) - 4) : '-4')."px; background-image: url('data:".$_SESSION['user']['image']['mime'].";base64,".$_SESSION['user']['image']['base64']."'); background-repeat: no-repeat; background-size: cover; background-position: center;\">";
+ }
+ }
+ else {
+ $user_graphic_size = 18;
+ }
$html .= "
\n";
- $html .= " text['theme-label-user']."\">".$_SESSION['username']."";
+ $html .= " text['theme-label-user']."\">".($user_graphic ?? null).$_SESSION['username']."";
$html .= "\n";
//domain name/selector (sm+)
if (!empty($_SESSION['username']) && permission_exists('domain_select') && count($_SESSION['domains']) > 1 && $_SESSION['theme']['domain_visible']['text'] == 'true') {
$html .= "
\n";
- $html .= " ".escape($_SESSION['domain_name'])."";
+ $html .= " ".escape($_SESSION['domain_name'])."";
$html .= "\n";
}
//logout icon
diff --git a/themes/default/app_config.php b/themes/default/app_config.php
index 85b5a73574..a7c2548177 100644
--- a/themes/default/app_config.php
+++ b/themes/default/app_config.php
@@ -424,6 +424,22 @@
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Set the icon to use next to the current domain in the body header (Side Menu only).";
$y++;
+ $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "93ec46b9-741c-4789-8a0d-182b6bed626b";
+ $apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
+ $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "body_header_user_image";
+ $apps[$x]['default_settings'][$y]['default_setting_name'] = "boolean";
+ $apps[$x]['default_settings'][$y]['default_setting_value'] = "true";
+ $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
+ $apps[$x]['default_settings'][$y]['default_setting_description'] = "Whether to display the primary Contact Attachment image assigned to the User (if any) in the body header.";
+ $y++;
+ $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "5a26aa8e-e35c-4f55-a339-28b3c64c2e45";
+ $apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
+ $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "body_header_user_image_size";
+ $apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric";
+ $apps[$x]['default_settings'][$y]['default_setting_value'] = "18";
+ $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false";
+ $apps[$x]['default_settings'][$y]['default_setting_description'] = "Set the pixel size of the User's Contact Attachment image displayed in the body header (default: 18).";
+ $y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "2eb360bc-7d11-4aa3-8540-221bd0a560cd";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "body_header_text_link_color";