How do I get the default user picture?
I am using the following code to get the URL of the image associated to a user.
$user=DrupaluserEntityUser::load(Drupal::currentUser()->id()); $picture=$user->get('user_picture')->entity->url();
If the user didn’t upload a picture, this code doesn’t return anything useful.
How can I get the URL for the default image?
This article was republished from its original source.
Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.