Zum Inhalt springen

Customize your Geocaching Statbar

Groudspeak offers a statistics (statbar) image, showing your username and the number of caches you have found and hidden. However, cutomisation of this image is very limited. You can choose between “signal the frog” and the geocaching.com logo and you can add a small text below your stats, but further than that, nothing more can be changed.

Let's do some simple image manipulation

Statbar customization

So I decided to write a little PHP script which grabs the original statbar image from geocaching.com and even saves resources, as it does so, only once a day. It changes the logo and some of the text and creates a new image. The only thing that is not changed, is the line showing the number of finds and hides. As PHP does not have any usable OCR capability it's near to impossible to modify the look of this line in the statbar.


The script code

//edit settings here
$uid 'your-geocaching.com-uid';
$username 'some text';
$font 'myfreefont.ttf';

//get image from geocaching.com if temp.png is not existant or temp.png is older than 1 day
if (!file_exists('temp.png') || filemtime('temp.png') < (time()-86400)) {
$url "http://img.geocaching.com/stats/img.aspx?txt=$uid";
$ch curl_init($url);
$fp fopen('temp.png''wb');
curl_setopt($chCURLOPT_TIMEOUT10); //try for 10 secs max.

if (
file_exists('temp.png')) {
$font_file './'.$font;

//create image instances
$dest imagecreatefrompng('background.png');
$src imagecreatefrompng('temp.png');

//set colors
$white imagecolorallocate($src255255255); //white
$text_color imagecolorallocate($dest000); //blacky
$background imagecolorallocate($dest240240240); //gray, adjust to your background color

  //set transparancy (comment out, if you don't want transparency!)

//add text above stats

//copy part of temp.png onto background.png

// Output image to browser
header('Content-Type: image/png');

//free php memory


Here the zip file to download. It includes the PHP script, a blank background image (change it to your liking) and a samle free font. newstatbar.zip

How to find out what your UID is

Log into your geocaching.com account. In the menu click on "Your Profile" and select "Quick View". On the right click on the geocaching.com statbar. In your browser address bar in your browser you will see a URL ending with guid=5fexxxx84-7xx2-4x03-b141-cexxxxxd9. Copy that long number with the dashes. That's your UID.

Things to know

The original statbar image from geocaching.com is only downloaded once a day. This saves your resources and those of geocaching.com. You can reduce this time, but I don't recommend doing so. The new image that will be created is also a PNG. You could change it to JPG or GIF, but I would recomment staying with PNG, as this is the format of the original image too and it's easier to get good transparency. Make sure to set the font name exactly as it is, e.g. if it's capitalized, enter it that way into the script.

Things to do

After unpacking the downloaded zip file, edit the newstatbar.php with a text editor and enter your personal UID. Upload the folder newstatbar to your webserver. You may have to chmod the folder to 777. You can call the new statbar in your browser like this: http://mysite.com/newstatbar/newstatbar.php. This is also the URL you would include in an image tag in your html code.


Ranger Fox Statbar Modifier

Ranger Fox

A service from Ranger Fox allows you to customize the geocaching.com statbar, but unfortunately it does not give you full control. It's an alternative if you don't have your own web space or your site does not have PHP. You can request to include you own logo or image on the site, but I didn't fancy having our logo selectable for anyone using that service.

Statbarfrosch from Gummiseele


Another alternative, just discovered today (22.09.2011) is the service from Gummiseele. Different to Ranger Fox you can change the logo to what ever you want, and this image can be hosted on your own server or where ever you want. He also provides Top-Cacher statbars for various cities in Germany. Well worth a look.

Kommentiere diesen Artikel

Kommentar (erforderlich) (keine Anzeige) (optional)
Ja, erkenne mich, wenn ich das nächste mal hier bin