An example of MonsterID

I was skimming Simon Willison’s blog (I know his uncle) when I came across this cool idea for automatic avatar generation. Well to tell the truth, I took one look at the title “Visual Security: 9-block IP Identification” and deleted the link from my RSS reader but the next day a link based on that idea came up for generating a unique monster avatar for each user that did catch my interest. After all if it’s got monsters, it has got to be interesting.

Anyway it turns out that Don Park decided to use a commenter’s IP address to generate a random (but persistent for each user) geometric image to associate with each user. This means that without needing external images or sites, each user can have a unique picture associated with them. Even better if several sites were to use the same algorithm for generating the image, the image would stay associated with the user across sites without any cross site communication. Andreas Gohr ran with this idea and decided to generate monsters instead of geometric images and use email addresses instead of IP addresses. So that brings the story here, since these two real programmers had already done all the hard thinking and programming, I thought I would make a quick and dirty WordPress plugin to incorporate MonsterIDs easily into other blogs. So here is WP_MonsterID. It’s my first real WordPress plugin so it may not be pretty but it seems to be working OK here (see monsters in the comments below). Edit: If monsters aren’t your thing, I have another plugin using just Don Park’s geometric shapes.


  • Monsters
  • Dynamically generated avatars for each commenter
  • Consistent on any blog
  • Gravatar support
  • Theme edits no longer necessary

Current Version:

WP_MonsterID v3.0

Installation instructions:

Unzip monsterid.zip. Upload wp_monsterid.php and the monsterid folder. Make sure the monsterid folder is writable. That should be it. Monsters should now appear beside your commenters’ names.

You can add CSS for img.monsterid in your theme’s style.css to adjust the appearance of the images or adjust the size in the MonsterID control panel (your old monsters won’t be deleted until you clear the cache). You can also turn on Gravatar support and clear the MonsterID image cache in the Control Panel.

Tai has translated the installation instructions to Japanese, 5lineas translated them to Spanish, and Dennys has installation tips in Chinese (although these are a bit out of date as of Version 1.0).

Change Log:

  • v3.0 12-10-2014:
    • Changed to pure php Mersenne twister to avoid mysql integer overflow problems. This will change monsters to change if you clear the cache.
  • v2.12 05-18-2008:
    • Fixed missing WP 2.5+ builtin avatars
  • v2.11 05-17-2008:
    • Fixed recent comment widget double monsters on single pages
    • Added support for WP 2.5+ builtin avatars
  • v2.1 03-04-2008:
    • Improved default CSS for MonsterID Recent Comments Widget
    • Added custom CSS editing for widget and MonsterID’s
    • Optimized artistic monsters to only loop through the square region containing the part
  • v2.04 2-14-2008:
    • Removed smaller MonsterID option
    • Added Recent Comments (with MonsterID) widget (since default Recent Comment Widget doesn’t provide commenter email)
  • v2.02 2-13-2008:
    • Removed monsterid from admin menus when using smaller MonsterIDs
  • v2.01 2-12-2008:
    • Add size to img attributes to avoid resizing page as loaded
    • Added option for smaller MonsterIDs on non-post page (like the Recent Comment Widget on the home page)
  • v2.0 2-05-2008:
    • Added artistic monsters (thanks to the great artwork of Lemm)
    • Artistic monsters are a bit tough on the server so limited generation time to a max of 5 seconds (unless the user is an admin)
    • Changed to object-oriented monsterid although not completely OOP
    • Added options for greyscale artistic monsters or old fashioned monsters
  • v1.02 1-03-2008:
    • Fixed sizing bug (thanks to Daniel)
    • Added size attribute to icons so page doesn’t resize as loaded
    • Removed a couple minor bugs
  • v1.01 12-21-2007:
    • Fixed automatic placement in unwanted places (again thanks to Shamus)
    • Switching download link to WordPress Extends
    • Fixed version numbers in plugin file
  • v1.0 12-19-2007:
    • Added option to use show gravatars if they exist and fallback to MonsterID
    • Theme edits no longer necessary (doesn’t hurt if you already did edit it) (This and the previous thanks to Shamus’s nice Wavatar plugin)
    • Cleaned up Options page and error checking
    • Caught possible infinite loop if user selects really dark or light body colors
  • v0.61 12-12-2007:
    • Changed to wiki pseudocode version of Mersenne Twister
    • Changed bitshifting to mysql queries since many php versions only have 31 bit integers while Mersenne requires 32
    • Sort part lists to keep things consistent on different servers
  • v0.6 12-11-2007:
    • Changed to pure PHP version of Mersenne Twister to allow consistent random numbers across servers
  • v0.511-14-2007:
    • Added reminder to clear cache after setting options
    • Added option to switch to white outlines for dark backgrounds
    • Added a few minor parts
  • v0.42 8-17-2007:
    • Fixed unintended white background on one pair of legs
  • v0.41 8-1-2007:
    • Fixed lower limit in monster_mt_array_rand
    • Readded back.png to parts
  • v0.4 7-30-2007:
    • MonsterID’s should now be consistent across servers (by changing rand to mt_rand)
    • Now checks the lightness of body color to make sure monsters aren’t too dark
    • Added some more new monster parts and changed the size slightly on a few older ones
    • Minor bug and WP standards fixes
  • v0.3 1-25-2007:
    • Added option to make background transparent. Just set the background color to 0 0 0 for Red, Green and Blue. Note that IE6 does not like transparent png and will turn the background grey.
    • Changed get_bloginfo('url') to get_settings('siteurl') to avoid problems when Options > General > Blog address (URI) is not default
    • Added a few new monster parts and increased the size slightly on a couple of older ones
    • Fixed incorrect link in plugin information
    • Increased length of email hash substring used to generate monster. Should increase possible combinations into the billions.
  • v0.2 1-23-2007:
    • Important note: Changed base function from build_monster to monsterid_build_monster for WordPress function standards (I don’t suppose there’s any other plugins building monsters out there but better safe).
    • Incorporated Adrean’s new extra monster parts and random body coloring and a few parts of my own.
    • Added a random background coloring and the option to set the coloring in the MonsterID menu.
    • Added a test section to the MonsterID menu.
    • Monster building automatically finds monster parts now so the users can add custom monster parts or delete parts they don’t like.
    • Added option to output only image url to monsterid_build_monster: monsterid_build_monster($comment->comment_author_email,$comment->comment_author,false)
  • v0.11 1-21-2007:
    • Got off to a pretty inauspicious start with a faulty wordpress page, a couple of immediate small bugs and a faulty file name.
  • v0.1 1-21-2007:
    • First version.

For Advanced Users

If you want more control of where MonsterID’s appear, disable the Automatically Add option and find the comments.php of your current theme (it should be in the folder wp-content/themes/[currentThemeName]/). Open it up and look for something similar to foreach ($comments as $comment). Inside this loop there should be code that displays the comment author’s name or metadata like <p class="comment-author"> or <p class="comment-metadata">. Just before all this enter:
<?php if (function_exists("monsterid_build_monster")) {echo monsterid_build_monster($comment->comment_author_email,$comment->comment_author); } ?>

If you would prefer to base the monsters on the commentor’s IP address instead of the commentor’s email just replace $comment->comment_author_email in the above with $comment->comment_author_IP.


If you want to customize the monster parts used in your version of WP_MonsterID just go to the wp-contents/monsterid/parts/ folder and delete any parts you don’t like. If you’d like to add your own parts, there is a Gimp file included in that folder containing a layer for each current part which should make constructing new parts easy. Save the new parts following the same conventions bodypartname_initial(s)#.png (e.g. arms_S1.png). If you come up with any good ones, feel free to send them to me and I’ll include them in the package.