Image Based Flair

I have created an implementation of flair which generates an image of your current reputation automatically. It is currently using PHP GD.

Download Source (Version 2.1 - 2009-08-03)

Current Features

Edit your accounts by opening system/config.yaml and editing the values.

Create your own themes by editing/adding YAML files. (2 themes by default [basic,advanced] in 2 different flavors [normal, inverted])

Currently supports all 4 SO sites. Adapts to new additions to the StackOverflow family with a simple config file.


This script no longer works due to the new flair API. I have no intention of updating it.

The desktop theme included in the distribution will not render exactly the same as the above. The reason is that I didn't include one font used due to licensing restrictions. For reference, the reputation font (missing) is DIN 1451 Engschrift LT. The theme files are as in, so by dropping in the font as dinb.ttf in the system/fonts folder, it should render as the above.


Version 2.1 - 2009-08-03:

  • Fixed imageantialias() error on packaged versions of php-gd.
  • Renamed and reorganized themes.
  • Added light-bg version of the SO logos.

Version 2.0 - 2009-07-31:

  • Complete rewrite. The theme engine is now extremely flexible and allows the creation of complex themes. I've added one as an example.

Version 1.2 - 2009-07-25:

  • Added "service" mode. To use, make sure id is set to false in system/config.yaml, then specify the ID before the theme: /1/basic/StackOverflow.png.

Version 1.1 - 2009-07-25:

  • Fixed display parameter being ignored for some objects
  • Fixed bug where a badges.icons.size value 0 or lower made the generation fail.


You need PHP 5.2.3 or greater, php_gd, and allow_fopen_url = 1 for this script to work. Make sure to make system/cache writable (an .htaccess file protects the directory from outside reads).

Combining Images

Kyle Cronin asked if I could provide an example on how to combine the images. You can use the following script to do so:

// If you have PHP 5.3 and the timezone isn't set properly.
date_default_timezone_set (@date_default_timezone_get());

require_once ('system/classes/spyc.php');
require_once ('system/classes/Image.php');

$theme = 'advanced';

header ('Expires: ' . date('r', time() + 300));
$flair_config = Spyc::YAMLLoad('system/config.yaml');
$domain = 'http://mydomain.com/flair/';

$width = 0;
$height = 0;
$padding = 10;

$images = array();

foreach($flair_config as $site => $data) {
    $images[$site] = new Image();
    $images[$site]->open($domain . $theme . '/' . $site . '.png');
    $width += $padding + $images[$site]->width();
    $height = max($height, $images[$site]->height());

$width -= $padding;

$img = new Image();
$img->new_transparent($width, $height);


$offset = 0;

foreach($images as $image) {
    $img->paste($image, $offset, 0);
    $offset += $image->width() + $padding;


migrated from meta.stackoverflow.com Aug 31 '12 at 12:15

This question came from our discussion, support, and feature requests site for professional and enthusiast programmers.

  • 1
    not that I object, by why is this 'downloadable'? why not offer a simple service that offers this by including the site/userid in the url? – Kyle Cronin Jul 25 '09 at 5:34
  • 3
    @Kyle Cronin: I don't have the bandwidth and the CPU usage to constantly generate images for everyone. – Andrew Moore Jul 25 '09 at 6:10
  • 3
    @Andrea I can help with the bandwidth, CPU and domains, you interested? : - ) – chakrit Jul 25 '09 at 9:00
  • @chakrit: Sure, go ahead if you want to... The source code will need small modifications in order to work as a service. I'll leave that to your capable hands. Just be sure to properly attribute credit. – Andrew Moore Jul 25 '09 at 15:21
  • 1
    Related question meta.stackoverflow.com/questions/1475/… – Brad Gilbert Jul 25 '09 at 17:40
  • @Andrew problems was ... I sucked at PHP : - ( ... but I'll give it some time tonight anyway : - ) – chakrit Jul 25 '09 at 18:11
  • @chakrit: Alright, I did modifications. Download the latest version. – Andrew Moore Jul 25 '09 at 18:24
  • any chance for an update to this? looks like stack exchange changed and now breaks this image flair. thanks – David Young Mar 1 '11 at 23:09

Got any plans to publish this as WordPress plugin

  • It really doesn't need to... Just edit your templates to add the image in the sidebar. – Andrew Moore Jan 14 '10 at 23:09
  • @Benny: The whole thing needs to be rewritten for the new API. I don't have time to do it. I also won't be creating a WP plugin for this. – Andrew Moore Jan 27 '11 at 9:51
  • @Benny: It's not a question of help, it's a question of lack of time. – Andrew Moore Jan 27 '11 at 9:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .