Some programming paradigms (Razor in ASP.NET or ASP.NET MVC 3, for example) have their own helpers to work with social media. If the paradigm you are programming in does not have helpers, you will have to access the FaceBook and/or Twitter APIs and use them to get the "avatar".

I have not played with Facebook, but the Twitter avatar link is provided on the user's profile, when you get it.

you have to use facebook's graph API to get profile pictures. You'll have to register your app with facebook to get an API key, and then you can access most of the information on a given user's profile.check out their developer page to see some examples

Twitter just changed the way they handle API call. Looks like you'll have to register your app with them as well to get access to the avatars. I haven't used the twitter API since they changed it, so i'm not a sure about what goes on, but check out the docs page to read up on what you'd have to do.