What about trying to insert a call to that function around line 134 in bp-core-avatars.php? Just above where it has four checks (one of them is ‘File you uploaded is too big’ and ‘Please upload only JPG, GIF or PNG photos’).