1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 14:46:56 +02:00

Support for high-resolution avatar rendering.

This commit is contained in:
Cameron
2020-01-27 11:37:57 -08:00
parent 48ae6455a4
commit ab0b4ec49b

View File

@@ -4283,6 +4283,7 @@ class e_parser
* @param string $options['class'] - override default 'class' attribute in tag. * @param string $options['class'] - override default 'class' attribute in tag.
* @param string $options['alt'] - override default 'alt' attribute in tag. * @param string $options['alt'] - override default 'alt' attribute in tag.
* @param bool $options['base64'] - use embedded base64 for image src. * @param bool $options['base64'] - use embedded base64 for image src.
* @param bool $options['hd'] - double the resolution of the image. Useful for retina displays.
* @param string $options['type'] - when set to 'url' returns the URL value instead of the tag. * @param string $options['type'] - when set to 'url' returns the URL value instead of the tag.
* @return string <img> tag of avatar. * @return string <img> tag of avatar.
*/ */
@@ -4301,6 +4302,12 @@ class e_parser
$height = intval($options['h']); $height = intval($options['h']);
} }
if(!empty($options['hd'])) // Fix resolution on Retina display.
{
$width = $width * 2;
$height = $height * 2;
}
if($userData === null && USERID) if($userData === null && USERID)
{ {
@@ -4364,7 +4371,12 @@ class e_parser
$ext = strtolower(pathinfo($file,PATHINFO_EXTENSION)); $ext = strtolower(pathinfo($file,PATHINFO_EXTENSION));
$url = 'data:image/'.$ext.';base64,'.base64_encode($content); $url = 'data:image/'.$ext.';base64,'.base64_encode($content);
} }
}
if(!empty($options['hd'])) // Fix resolution on Retina display.
{
$width = $width / 2;
$height = ($height / 2);
} }
if(($url == $genericImg) && !empty($userData['user_id'] ) && (($userData['user_id'] == USERID)) && !empty($options['link'])) if(($url == $genericImg) && !empty($userData['user_id'] ) && (($userData['user_id'] == USERID)) && !empty($options['link']))