<nav id="topMenu" class="userPanel{if $__wcf->user->userID} userPanelLoggedIn{/if}">
{if $__wcf->user->userID}
- <span class="userPanelAvatar" aria-hidden="true">{@$__wcf->getUserProfileHandler()->getAvatar()->getImageTag(32)}</span>
+ <span class="userPanelAvatar" aria-hidden="true">{@$__wcf->getUserProfileHandler()->getAvatar()->getImageTag(32, false)}</span>
{else}
<a href="{link controller='Login' url=$__wcf->getRequestURI()}{/link}" class="userPanelLoginLink jsTooltip" title="{lang}wcf.user.loginOrRegister{/lang}">
<span class="icon icon32 fa-sign-in" aria-hidden="true"></span>
aria-haspopup="true"
aria-expanded="false"
>
- {@$__wcf->getUserProfileHandler()->getAvatar()->getImageTag(32)} <span>{lang}wcf.user.userNote{/lang}</span>
+ {@$__wcf->getUserProfileHandler()->getAvatar()->getImageTag(32, false)} <span>{lang}wcf.user.userNote{/lang}</span>
</a>
<div class="userMenu userMenuControlPanel" data-origin="userMenu" tabindex="-1" hidden>
<div class="userMenuHeader">
/**
* @inheritDoc
*/
- public function getImageTag($size = null)
+ public function getImageTag($size = null, bool $lazyLoading = true)
{
- return $this->avatar->getImageTag($size);
+ return $this->avatar->getImageTag($size, $lazyLoading);
}
/**
/**
* @inheritDoc
*/
- public function getImageTag($size = null)
+ public function getImageTag($size = null, bool $lazyLoading = true)
{
- return '<img src="' . StringUtil::encodeHTML($this->getURL($size)) . '" width="' . $size . '" height="' . $size . '" alt="" class="userAvatarImage" loading="lazy">';
+ return \sprintf(
+ '<img src="%s" width="%d" height="%d" alt="" class="userAvatarImage" loading="%s">',
+ StringUtil::encodeHTML($this->getURL($size)),
+ $size,
+ $size,
+ $lazyLoading ? 'lazy' : 'eager'
+ );
}
/**