How do i set profile image as first letters of first and last name?

generate avatars with initials from names
initials profile picture
css name initial
jquery letter avatar
upload profile picture html code
javascript get initials from name
circle with name css
google profile initials

Basically, i'm working on user registration system. which i'm doing front-end using ReactJS. for registered users there is an option to add images for their profiles. when there is no images for the profiles, profile image should be contain the first letter from the first and second name for the profile picture like google plus do.

please find the sample image below.

Looking forward a way to do this.. better if there are inbuilt plugin or library to do this.

I have assumed that you have access to the first name and last name. Using that, I have written this code which will take the first letter from First name and last name and apply to your profile image.

  var firstName = $('#firstName').text();
  var lastName = $('#lastName').text();
  var intials = $('#firstName').text().charAt(0) + $('#lastName').text().charAt(0);
  var profileImage = $('#profileImage').text(intials);
#profileImage {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: #512DA8;
  font-size: 35px;
  color: #fff;
  text-align: center;
  line-height: 150px;
  margin: 20px 0;
<script src=""></script>

<span id="firstName">Kalpesh</span>
<span id="lastName">Singh</span>
<div id="profileImage"></div>

Set profile image as first letters of first and last name, $(document). ready(function(){ var firstName = $('#firstName'). text(); var lastName = $('#lastName'). text(); var intials = firstName. charAt(0) + lastName. charAt(0); var profileImage = $('#profileImage'). text(intials); Today we will learn in this article how to generate an image dynamically by taking the user’s first and last names. I have created this demo in MVC application, you can use this on any C# platform, even on the Windows form application, as we are using pure C# to generate image from text.

how to display first letter of first and last name of profile user within a , well i did it if any body want the same can copy paste the same samplecmp.apxc public class ProfileValueController { @AuraEnabled public  Profile Picture: To add or change your profile picture, click Change, then adjust the crop area on your current picture or upload a new one. You can also delete your profile picture by clicking Delete. Name: To change your name, click Edit on the right side.

My solution takes care of user names with names having more than 2 words. I used regex to extract first letters of space separated name components.

    var matches = str.match(/\b(\w)/g);
    var acronym = matches.join('');
    document.getElementById("name_acronym").innerHTML = acronym;

Call this function containing this from your HTML code and "name_acronym" is the id for the profile picture text.

Default set User profile pic having first letter and of last name., In laravel How can I default set the profile image for user if he left upload image. default image created like this: click  Is there a simple way to programmatically generate (placeholder) images based on the first letters of user's first and last name in Xamarin.Forms? Background color could be randomly generated, but in a way that the same user would be given the same color every time.

Simple way of getting first character of a string. And even some times you might get $ as undefined when your using

var firstName = $('#firstName').text();

try this ...

var firstName = "Jhon";
var initial = firstName.charAt(0);
console.log('--------', initial);

by this you should get "J" as output

How to set profile image as first letters of first and last name?, How to set profile image as first letters of first and last name? I have assumed that you have access to the first name and last name. With iOS 13 for iPhone and iPad, you can now set up your own iMessage profile with a first name, last name, and profile picture. The next time you chat to someone with iMessage, they can update

It could be written in one-liner.

fullName.split(' ').map(name => name[0]).join('').toUpperCase()

Runnable snippet:

const fullName = document.getElementById('fullName').textContent;
const intials = fullName.split(' ').map(name => name[0]).join('').toUpperCase();
document.getElementById('profileImage').innerHTML = intials;
#profileImage {
  font-family: Arial, Helvetica, sans-serif;
  width: 10rem;
  height: 10rem;
  border-radius: 50%;
  background: #0c540c;
  font-size: 3.5rem;
  color: #fff;
  text-align: center;
  line-height: 10rem;
  margin: 2rem 0;
<div id="profileImage"></div>
<span id="fullName">Penny Liu</span>

How to get name initials as an image?, a very common use case. Gone were the days when we used to show anonymous image in case a person's profile. We can easily show a person's name initials as an image to identify the person. Like : profilePicUrl || getInitials(​}}" alt="{{}}"> var initials = first + last;. context. You can choose a photo to set as your Gmail profile picture. This image shows up when someone sees your name in their email inbox or chat list. Your Gmail profile picture is the same as your Google Account picture. Learn how to change your Google Account name and other info.

Create Default Profile Image Dynamically From First And Last Name , This method will generate a 110 x 100 size gif format image and store that image into the “images” folder; you can change size and format as per  jewellery silver locket photo with my name alphabet for whatsapp dp.write your initial alphabet on image and you can set that image as a whatsapp profile pictures.stylish aphabet edit on kechain dp free first alphabet profile pictures generator letters images maker for whatsapp dp and facebook profile can write any leter on image and make unique dp online

How do i set profile image as first letter of name?, Use first letter of name as profile image in website using jquery and css.Profile image is identity of a user in a website. online name add in cute teddy bear image.Cute teddy bear Facebook Profile Pictures For Girls with name editing option.generating name on teddy bear Alphabet Profile Pic For Whatsapp jewellery silver locket photo with my name alphabet for whatsapp dp.write your initial alphabet on image and you can set that image as a whatsapp p

Default Avatars with Username Initials, Many apps are moving away from static image default user avatars and instead from your user, such as the first two letters of their username, email, or first and last name. HTML and Ruby Code to Display the Avatar in this example), then set the font-size and line-height to 50% of the parent (or 50px). In the desktop app and web client of Teams, my avatar shows up as CJ (Last Initial, First Initial) - It does this despite my Azure AD account having a profile pic assigned to it (my installation of Office uses it correctly) -- Other employees at my organization have their profile pics properly shown