avatar: Remove redundant variables
avatar: Force to use static method when function was called >= 2 times.

Theoretically, it improves perfomance, especially in viewthread. I think
it's better than N times of request to avatar.php