MyBB Community Forums

Full Version: .TGA files?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Okay,
I made a new gallery, but it won't recognize .tga files, is there a fix for this?

I mean a new avatar gallery, and that MyBB won't recognize the files.
Hi,

The avatar gallery only detects jpg, jpeg, gif, and png image types by default. This is because these types are supported by PHP (getimagesize - along with a few others) and are the mot common web formats.

If you wish to allow the avatar gallery to show other file types you need to edit usercp.php and find:

			if(is_file($avatarpath) && preg_match("#\.(jpg|jpeg|gif|bmp|png)$#i", $avatar))
			{
				$avatars[] = $avatar;
			}

You need to add the other file extensions separated with a pipe (|) after the png. So you'd add |tga after png.

You then need to find the following line (to remove the .tga from the list of display names):

$avatarname = preg_replace("#\.(jpg|jpeg|gif|bmp|png)$#i", "", $avatar);

Smilarly, add |tga after png.

Regards,
Chris