<dl class="jsOnly{if $errorField == 'custom'} formError{/if}" id="avatarUpload">
<dt class="framed">
{if $avatarType == 'custom'}
- {assign var='__customAvatar' value=$__wcf->getUserProfileHandler()->getAvatar()->getImageTag(96)}
{if $__wcf->getUserProfileHandler()->getAvatar()->canCrop()}
- {assign var='__customAvatar' value=$__customAvatar|substr:0:-2}
- {assign var='__customAvatarTitle' value='wcf.user.avatar.type.custom.crop'|language}
- {append var='__customAvatar' value='class="userAvatarCrop jsTooltip" title="'|concat:$__customAvatarTitle:'" />'}
+ {@$__wcf->getUserProfileHandler()->getAvatar()->getCropImageTag(96)}
+ {else}
+ {@$__wcf->getUserProfileHandler()->getAvatar()->getImageTag(96)}
{/if}
- {@$__customAvatar}
{else}
<img src="{@$__wcf->getPath()}images/avatars/avatar-default.svg" alt="" class="icon96" />
{/if}
public function canCrop() {
return false;
}
+
+ /**
+ * @see \wcf\data\user\avatar\IUserAvatar::getCropImageTag()
+ */
+ public function getCropImageTag($size = null) {
+ return '';
+ }
}
*/
public function getImageTag($size = null);
+ /**
+ * Returns the image tag used for cropping.
+ *
+ * @param integer $size
+ * @return string
+ */
+ public function getCropImageTag($size = null);
+
/**
* Returns the width of this avatar.
*
switch ($size) {
case 16:
$retinaSize = 32;
- break;
+ break;
+
case 24:
case 32:
case 48:
$retinaSize = 96;
- break;
+ break;
+
case 64:
case 96:
$retinaSize = 128;
- break;
+ break;
}
return '<img src="'.StringUtil::encodeHTML($this->getURL($size)).'" '.($retinaSize !== null ? ('srcset="'.StringUtil::encodeHTML($this->getURL($retinaSize)).' 2x" ') : '').'style="width: '.$width.'px; height: '.$height.'px" alt="'.WCF::getLanguage()->get('wcf.user.avatar.alt').'" class="userAvatarImage" />';
}
+ /**
+ * @see \wcf\data\user\avatar\IUserAvatar::getCropImageTag()
+ */
+ public function getCropImageTag($size = null) {
+ $imageTag = $this->getImageTag($size);
+
+ // append CSS classes and append title
+ $title = StringUtil::encodeHTML(WCF::getLanguage()->get('wcf.user.avatar.type.custom.crop'));
+
+ return str_replace('class="userAvatarImage"', 'class="userAvatarImage userAvatarCrop jsTooltip" title="'.$title.'"', $imageTag);
+ }
+
/**
* @see \wcf\data\user\avatar\IUserAvatar::getWidth()
*/