Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mystralkk committed Apr 14, 2022
2 parents 20ab04f + 592bfba commit 7f3c45e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions system/lib-user.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ function USER_getPhoto($uid = 0, $photo = '', $email = '', $width = 0, $cssClass
}

$img = '';

$sizeAttributes = [];
if ($uid == 1) {
// For anonymous users
if (!empty($_CONF['default_photo'])) {
Expand Down Expand Up @@ -486,10 +486,14 @@ function USER_getPhoto($uid = 0, $photo = '', $email = '', $width = 0, $cssClass
} else {
$img = $_CONF['site_url'] . '/getimage.php?mode=userphotos&image=' . $photo;
}

$sizeAttributes = COM_getImgSizeAttributes($_CONF['path_images'] . 'userphotos/' . $photo, false);
}

if (empty($img) && !empty($_CONF['default_photo'])) {
$img = $_CONF['default_photo'];

$sizeAttributes = COM_getImgSizeAttributes($_CONF['path_images'] . 'userphotos/' . $photo, false);
}
}

Expand All @@ -498,7 +502,15 @@ function USER_getPhoto($uid = 0, $photo = '', $email = '', $width = 0, $cssClass
$userPhoto = '<img src="' . $img . '"';
if ($width > 0) {
$userPhoto .= ' width="' . $width . '"';
}
if (isset($sizeAttributes['height'])) {
// figure out height ratio
$ratio = $width / $sizeAttributes['width'];
$userPhoto .= ' height="' . ($sizeAttributes['height'] * $ratio) . '"';
}
} else {
$userPhoto .= ' width="' . $sizeAttributes['width'] . '" height="' . $sizeAttributes['height'] . '"';
}

$userPhoto .= ' alt="" title="' . $displayName . '" class="' . $cssClasses . '"' . XHTML . '>';
} else {
$userPhoto = USER_generateUserICON($uid, $width, $cssClasses, $anonName);
Expand Down

0 comments on commit 7f3c45e

Please sign in to comment.