MyBB Community Forums

Full Version: "Avatar does not appear to be valid" error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello!

I'm getting the following error:

[Image: 702224adcd50dc2cb96b48c4aec12fcf.png]

The image URL I'm entering is: https://random.nickpic.host/80502.gif

I'm not sure why it isn't working. If anyone has any input, that would be excellent.

Thank you!
The URL you provided redirects to https://img.nickpic.host/ce786Y.png

Though I haven't checked in the code that this is the case, the redirect might be causing the problem.

Perhaps try using the redirected-to URL rather than the redirecting one.
The link is to a folder of images, which causes the avatar to 'rotate' when pages are refreshed.

Currently, I've been using: https://pile.randimg.net/2/189/172405/Ad...1597411768

Which gives the same result (a new image from a collection upon each load) but doesn't have the error when saved.

Those images are housed on Imgur, whereas nickpic is hosted on nickpic.
OK. That's interesting.

I've checked the code, and, running some tests, it looks like (a) redirects shouldn't be a problem at all, and (b) there are only three places where that error message (with key error_invalidavatarurl) is generated in the UserCP, all in usercp.php. If you're comfortable debugging, you could try to narrow down which one of them is causing the problem, and then why.
thanks for the input, but I wouldn't even know where to start debugging. Code is a language I don't speak o.o
OK, I'll give you a hand with it then, assuming you're willing to give it a go.

I assume you're running the latest version of MyBB, 1.8.27. If not, the line numbers and potentially some of the code might be a little out, but you should be able to figure it out OK.

We'll be editing your usercp.php file. Here are the edits to make.

First, change line #2574 from:
				$avatar_error = $lang->error_invalidavatarurl;
to:
				$avatar_error = $lang->error_invalidavatarurl.' (fetch_remote_file() returned empty)';

Next, remove the @ from the front of fopen in line #2579.

Now, change line #2582 from:
					$avatar_error = $lang->error_invalidavatarurl;
to:
					$avatar_error = $lang->error_invalidavatarurl.' (fopen returned empty)';

And remove the @ preceding getimagesize on line #2588, and the @ preceding unlink on line #2589.

Finally, change line #2592 from:
						$avatar_error = $lang->error_invalidavatarurl;
to:
						$avatar_error = $lang->error_invalidavatarurl.' ($type was empty)';

All of this should be safe even on a live board - all it's going to do is add some more information to any errors/warnings that occur.

After you've made these changes, try again to set that avatar image and let us know which particular error message(s) you get.