MyBB Community Forums

Full Version: Resizing external avatars
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Now, I have just moved from SMF to MyBB (Best move with my forum yet I'd say), but for some reason external avatars refuse to be resized correctly, and are simply rejected if they are too big.

Now, being used to SMF's adminCP layout, I'm probably missing the little option box saying that I can allow external avvies to be resized, so mind if someone would point me in the right direction?

MyBB v1.6.7 by the way. Install it 2 days ago.

EDIT: Just found out that I can't use my avvie here either due to the size, so by any chance is it a to-be-added feature....?
i looked at the code and it appears that there is a mixed solution to the issue of avatar dimensions in remote avatars.

In build_postbit( ) there is code to scale the avatar, regardless of type and this is what you are looking for, so it is built-in

However, in usercp's do_avatar code, the remote file is not accepted if the dimensions are too large (as are locally uploaded files that can not be resized automatically).

So the solution for you would be a core edit to remove the dimension check on remote avatars in usercp.php by commenting out the following code

		if(empty($avatar_error))
		{
			if($width && $height && $mybb->settings['maxavatardims'] != "")
			{
				list($maxwidth, $maxheight) = explode("x", my_strtolower($mybb->settings['maxavatardims']));
				if(($maxwidth && $width > $maxwidth) || ($maxheight && $height > $maxheight))
				{
					$lang->error_avatartoobig = $lang->sprintf($lang->error_avatartoobig, $maxwidth, $maxheight);
					$avatar_error = $lang->error_avatartoobig;
				}
			}
		}
Thanks, that worked a treat.

I appreciate the time you took for something as silly as this too. ^.^
not silly at all, its just odd that the time spent to code the scaling routine in the postbit display is nearly useless as all oversized avatars are denied anyway
Well, either way, your fix worked, and that's all that counts I guess.

EDIT: I posted 1 min after you even though I was just doing a periodic check. odd timings or what? Toungue