I offer the following fix which ensures the Stock Avatar's width and height adhere to the defined maximum avatar limits whenever:
  • a user edits their profile and selects a Stock Avatar, or
  • an Admin/Mod edits a user's profile and selects a Stock Avatar.

While I have applied this fix to (my) version 7.5.3, it applies to 7.5.6 as well.

In scripts/changebasic.inc.php find:

PHP Code

	// -------------------------------------------------------
	// If we are using an avatar then we set the stuff up here
	if ($picchange == "avatar") {
		$Picture = $avurl;
		$imagewidth = $avwidth;
		$imageheight = $avheight;
	}
 

and change to:

PHP Code

	// -------------------------------------------------------
	// If we are using an avatar then we set the stuff up here
	if ($picchange == "avatar") {
		$Picture = $avurl;
		$imagewidth = $avwidth;
		$imageheight = $avheight;
		if ($config['AVATAR_MAX_WIDTH'] && $config['AVATAR_MAX_HEIGHT']) {
			if ($imagewidth > $config['AVATAR_MAX_WIDTH']) {
				$div = $imagewidth / $config['AVATAR_MAX_WIDTH'];
				$imagewidth = ceil($imagewidth / $div);
				$imageheight = ceil($imageheight / $div);
			}
			if ($imageheight > $config['AVATAR_MAX_HEIGHT']) {
				$div = $imageheight / $config['AVATAR_MAX_HEIGHT'];
				$imageheight = ceil($imageheight / $div);
				$imagewidth = ceil($imageheight / $div);
			}
		} // end if
	}
 

In admin/changeuser.php find:

PHP Code

if ($avatar == "stock") {
	$picture = $avurl;
	$imagewidth = $avwidth;
	$imageheight = $avheight;
	$picupdate = 1;
}
 

and change to:

PHP Code

if ($avatar == "stock") {
	$picture = $avurl;
	$imagewidth = $avwidth;
	$imageheight = $avheight;
	if ($config['AVATAR_MAX_WIDTH'] && $config['AVATAR_MAX_HEIGHT']) {
		if ($imagewidth > $config['AVATAR_MAX_WIDTH']) {
			$div = $imagewidth / $config['AVATAR_MAX_WIDTH'];
			$imagewidth = ceil($imagewidth / $div);
			$imageheight = ceil($imageheight / $div);
		}
		if ($imageheight > $config['AVATAR_MAX_HEIGHT']) {
			$div = $imageheight / $config['AVATAR_MAX_HEIGHT'];
			$imageheight = ceil($imageheight / $div);
			$imagewidth = ceil($imageheight / $div);
		}
	} // end if

	$picupdate = 1;
}
 

This has been implemented and tested successfully on my forum as shown on the first page of the thread that contains a mix of stock and user uploaded avatars, all of which obey my 80x80 limit.