Fixed broken images on mini-search/header search

Fixes http://forums.hummingbird.me/t/some-thumbnails-dont-show-up-in-the-search-suggestions/10281
Also, while coming up with a solution to this issue, I discovered that user avatars without a file extension were also broken, so I adjusted the regex, fixing avatars without file extensions also.

It's an ugly fix, but it works.
Anime don't have a 'small' thumbnail folder, only a 'medium', whereas users do have a 'small' folder for their avatars, hence why I check r.type. Also, links from users returned {size} instead of large, which complicated matters further, requiring me to check r.type a second time.