From ab0b4ec49b405075231ac8a7bb247aa96506bd4f Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 27 Jan 2020 11:37:57 -0800 Subject: [PATCH] Support for high-resolution avatar rendering. --- e107_handlers/e_parse_class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index feff6fdd4..884054b30 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -4283,6 +4283,7 @@ class e_parser * @param string $options['class'] - override default 'class' 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['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. * @return string tag of avatar. */ @@ -4301,6 +4302,12 @@ class e_parser $height = intval($options['h']); } + if(!empty($options['hd'])) // Fix resolution on Retina display. + { + $width = $width * 2; + $height = $height * 2; + } + if($userData === null && USERID) { @@ -4364,7 +4371,12 @@ class e_parser $ext = strtolower(pathinfo($file,PATHINFO_EXTENSION)); $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']))