Set an Image as a avatar (Profile Picture)

Hi,

Users have multiple files in their album. Now they need to set an image as a avatar from their already uploaded pictures. How to achieve this? Please help with code example. 

Thanks