Since you stored those names, then when you extract them you can as well extract first-letter of each words/names and store them in a data- attribute.
It is more a server-side (or javascript) job than CSS.
exemple with pseudo:
[data-letters]:before {
content:attr(data-letters);
display:inline-block;
font-size:1em;
width:2.5em;
height:2.5em;
line-height:2.5em;
text-align:center;
border-radius:50%;
background:plum;
vertical-align:middle;
margin-right:1em;
color:white;
}
<p data-letters="MN"> My Name</p><!-- or whatever structure you used -->