I've got this working with this:
string avatarImg = <img style=\"border-width: 0px;\" alt=\"Andy\"
src=\"/CMSModules/Avatars/CMSPages/GetAvatar.aspx?avatarguid="+ ai.AvatarGUID.ToString() +"&maxsidesize=50\" />";
And then outputting that to the literal text property.
Is that best practice?