Initials Profile Pics

General plugins (Local) ::: local_ciabinitialsprofilepics
Maintained by Me, with my new 'slow explosion' hair!Paul Vaughan
A local plugin for Moodle which automatically creates profile pictures for users based on their initials.
Latest release:
235 sites
20 fans
Current versions available: 1
This plugin currently runs on PHP 7.0 as a minimum and will fail on lower versions.

Initials Profile Pictures generator

A local plugin for Moodle which automatically creates profile pictures for users based on their initials.

Written by Paul Vaughan (, © 2018.


For our Moodle installation, we wanted unique profile pictures for each user instead of the generic default 'silhouette' image, without the requirement of each user uploading their own. This plugin automatically and silently creates a profile picture for each user from their initials when their profile is created or saved. A few classes were found which did roughly what we wanted, and they were used as inspiration for this plugin, as was the way the Android Contacts app displays people without images.

This plugin uses the Intervention Image library for PHP and was inspired by this wrapper for it.



This plugin has so far been tested with Moodle 3.2 and 3.4, but will probably work with all of the 3.x and most of the 2.x branches. It has a minimum requirement of PHP 7.0, however.


  • PHP's GD image library.
  • PHP 7.0 or later.

This plugin uses the Intervention Image library for PHP (it and it's dependencies are included with the plugin; there is no need to use Composer) and was inspired by this wrapper for it, with a tip of the hat to the way default contact images are displayed in the Android Contacts app.


Install as you would any local Moodle plugin, by copying or cloning the ciabinitialsprofilepics folder into your Moodle's local/ folder. If you use git clone, please ensure the folder name is exactly as stated as it will not install or work otherwise.

Log in to your Moodle as an administrator and head to the Notifications page, where all being well, Moodle will discover the new plugin and install it.

There are an increasing number of configuration options, and I plan to make more of the plugin configurable over time.

How It Works

This plugin hooks in to Moodle's events system, so what whenever a user is created or their profile updated, if a profile picture wasn't included, it makes one from the user's initials and saves it to the user's profile. If you upload a profile picture yourself, that will of course be used, however if a profile image is deleted, this plugin kicks in and generates a new one.

Edit an existing user (or yourself)

  1. Go to your profile.
  2. Click Edit Profile.
  3. If you already have a profile picture, check the Delete box underneath it.
  4. Save your profile.

When the page reloads, you should see a new profile picture. The colour you get is dependant on your first initial, and is not random: it will not change if you recreate the image! (There are some settings you can change to enable random colours, or force a specific colour.)

If you have rights to edit other people's profiles, following the above steps for other users will generate a new profile picture for that user.

Creating new users

As new users are created, they will automatically get a profile picture created for them by default.


Enabled: Check to enable; uncheck to disable. Note that this will not remove profile pictures created by this plugin.

Random Colour: Colours are usually chosen based on a user's first initial, so that if an image is removed and recreated, that user will get the same background colour. Check this option to choose a colour from the built-in palette utterly at random instead.

Force Colour: Pick a colour or type in a valid CSS hexadecimal colour code to force all images to use this colour.

Image Shape: Choose the shape of the generated image. There's quite a few to choose from. Note that some Moodle Themes may round the corners of images or make them appear circular (or other CSS trickery), despite the generated image not being that shape.

Font Size: Choose to have a big font which almost extends beyond the limit of the image, or a small font which is all clearly visible. Defaults to extra large (quite abstract).

Font Alpha: Choose the level of transparency, from 20% visible to 80% visible. (Defaults to just 20%.)

Note that some parts of the plugin without configuration settings can still be changed if you are happy to hack the locallib.php file. Most common settings are constants at the beginning of the file and have names like CIABINITIALSPROFILEPICS_BG_ALPHA.

To Do

Ideas I have had for future developments. If you want a feature added, raise an issue or send a pull request. smile

  • More shapes (some ideas, some implemented).
  • Multiple font choices, probably from a folder in the plugin, possibly using Google Fonts.
  • Editing of the built-in colour palette.
  • White or black text (multiple colours seems unnecessary...?).
  • Option to find all users without a profile picture and make them one.
    • Potentially do the above e.g. daily, via a scheduled task.
  • Option to remove all profile pictures and generate new ones.
  • Image generation exemptions for certain user types (such as admins) or users (whitelisted by ID).
  • Properly handle less (one) or more (up to four?) initials per image.


I've noticed that the images this plugin generates are around 18-20kb, give or take, but when the image has been processed and saved into Moodle, the image's size jumps up to around 150kb. This seems a little odd and unnecessary!


  • 2017-03-13: v1.0 Initial release.
  • 2017-03-14: v1.0.1 Use the correct font; update the current user's session with the new image.
  • 2017-03-14: v1.0.2 Missed a warning about duplicate admin pages - even though they work as intended.
  • 2017-04-01: v1.0.3 Refactored so that options and testing are easier to implement. Fixed a few minor bugs. Image size and scaling improved.
  • 2017-04-02: v1.0.4 Added font size and alpha-level settings (and corresponding tests).
  • 2017-04-05: v1.0.5 Replaced $str[0] with mb_substr($str, 0, 1) to better handle UTF8 characters. Unit tests.
  • 2017-04-07: v1.0.6 Shape selection option and more shapes.
  • 2017-05-10: v1.0.7 Fixes for some of the issues raised by's plugin validation process.
  • 2017-06-06: v1.0.8 More fixes for some of the issues raised by's plugin validation process, better testing, some minor bugs fixed.-*
  • 2018-03-26: v1.1 Purged all references to CiaB.
  • 2018-03-26: v1.1.1 Reverted most of the previous changes as the renaming of the whole plugin didn't play well with


This plugin is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this plugin. If not, see


Screenshot #0
Screenshot #1


Me, with my new 'slow explosion' hair!
Paul Vaughan (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Ricardo Caiado
    Sun, Mar 18, 2018, 4:36 AM
    Any updates do Moodle 3.4?

  • Me, with my new 'slow explosion' hair!
    Tue, Mar 27, 2018, 7:08 AM
    Hi Ricardo. This updated version should work fine on Moodle 3.4.
  • Fri, Apr 6, 2018, 5:09 PM
    Hi Paul

    Great plugin. Is there any way to 'force' everyone's profile to update, without them having to login, edit and save? With 100s of users, it would be nice to have a consistent look, and we can't rely on users to do this!

  • Ricardo Caiado
    Fri, Apr 6, 2018, 6:35 PM
    Hi Paul,

    I´ve got the same situation as Dan. In my case I´ve got +26.000 users.

  • Me, with my new 'slow explosion' hair!
    Mon, Apr 16, 2018, 12:52 AM
    Hi Dan, Ricardo. I've thought about that and it's on the to-do list. Give me a couple of days and I'll see what I can do!
  • Wed, May 9, 2018, 8:59 PM
    Thanks Paul. Having this option to force everyone without an image will be a great leap forward!
  • Mon, Jul 9, 2018, 8:13 AM
    Hi Paul - Will this work on 3.5?
  • Ricardo Caiado
    Mon, Jul 30, 2018, 6:53 PM

    Any update to Moodle 3.5?

  • Me, with my new 'slow explosion' hair!
    Wed, Jan 16, 2019, 6:38 AM
    This should work just fine in Moodle 3.5 and 3.6. I'm coming back to this plugin to add some features after a hiatus and initially, it works fine in 3.6, but more testing will happen soon as and when new features are added.
  • Mon, Feb 25, 2019, 8:41 PM
    When i upload users by using a csv file (as an admin), this plugin does not work properly. It works properly when i just add a new user manually.
  • Mon, Apr 29, 2019, 4:31 PM
    I can also confirm on version 3.6 that creating a new manual account works, whereas uploading users via a CSV file does not produce profile pictures/photos for the uploaded users sad
  • Me, with my new 'slow explosion' hair!
    Wed, Oct 23, 2019, 5:54 AM
    There's a new version of this plugin addressing the 'users uploaded via CSV not getting a profile image created' issue.
  • Thu, Oct 24, 2019, 4:55 PM
    Hello, plugin is great! I look into your to do list and i "need/want" exactly this one -> Multiple font choices, probably from a folder in the plugin, possibly using Google Fonts.
    For example i would like to have styled initials more like google (straight text, small text, space between firstname initial and lastname) smile

    Anyway, thanks for plugin and gl in future with development!
  • Fri, Apr 3, 2020, 11:00 AM
    I am using Moodle 3.8 and the plugin works fine for users created manually. However, when I login as an Office365 user through by using Open ID Connect the initials show when I first enter the profile page and save. But it then disappears when using Moodle as that user and I need to go back to the profile each time for them to return. Any ideas?
  • Fri, Jun 5, 2020, 6:18 PM

    Any update to Moodle 3.8?
1 2
Please login to post comments