https://www.icyphoenix.com/viewtopic.php?f=29&t=156&p=1520#p1520
-----------------------------------
Mighty Gorgon
Sun 27 Aug, 2006 21:41

Re: First Poster's Avatar's Width And Height
-----------------------------------
I think I have the solution, but since it may slow down page loading I won't add it to XS... :wink:

It uses getimagesize function:
[codeblock]function resize_avatar($avatar_url)
{
	global $board_config;
	$avatar_width = 80;
	$avatar_height = 80;
	if (function_exists('getimagesize'))
	{
		$pic_size = @getimagesize($avatar_url);
		if ($pic_size != false)
		{
			$pic_width = $pic_size[0];
			$pic_height = $pic_size[1];
			if ( ($pic_width < 80) && ($pic_height < 80) )
			{
				$avatar_width = $pic_width;
				$avatar_height = $pic_height;
			}
			elseif ($pic_width > $pic_height)
			{
				$avatar_width = 80;
				$avatar_height = 80 * ($pic_height/$pic_width);
			}
			else
			{
				$avatar_height = 80;
				$avatar_width = 80 * ($pic_width/$pic_height);
			}
		}
	}
	return ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $avatar_url . '" width="'. $avatar_width .'" height="' . $avatar_height .'" alt="" border="0" />' : '';
}[/codeblock]

Can you try this and let me know if it works please?


