Avatar as image for drawing, similar to WepSelectIcon

I’ve found the VGUI element AvatarImage, however I’m looking to see if there’s a better way than VGUI. Is there a way to get a player’s avatar image as a texture/material for use in surface.draw, like weapon.WepSelectIcon? I have used WepSelectIcon like this before:


			if ply:GetActiveWeapon()~=nil and ply:GetActiveWeapon().WepSelectIcon~=nil then
				surface.SetDrawColor(255,255,255,255)
				surface.SetTexture(ply:GetActiveWeapon().WepSelectIcon)
				surface.DrawTexturedRect(ScrW()-240,ScrH()-110,128,84)
			end

As far as I’m aware, AvatarImage is a panel declared in C, from CAvatarImagePanel, and the material variable it uses is private so you can’t access it, and I don’t think you can access the functions to get the avatar either, the only other way would be to build an HTML panel that could get the image, but that’s really just a pain in the ass, so you’re going to have to use AvatarImage.

What OzymandiasJ said is possible. You can grab the profile data from Steam Community servers by running http.Get with http://steamcommunity.com/profiles/<64bit steam id>/?xml=1 (example) and grab the material like it’s done in PAC.