Creating Dynamic Userbars in PHP

A number of sites I’ve worked on have dynamic Userbars available for elements around the site. These are really useful for creating dynamic counters/countdowns etc.

To make it easier for myself so I could very quickly make more Userbars wherever I wanted, I built a PHP class that creates a GD image object containing a custom Userbar. With that object, you can save it to an image, output it to screen, store it in memory, store it in a database or whatever you need.

Here is an example that the given library produces by default (note, this example is saved and not dynamic itself):

Features

  • Customisable:
    • Text
    • Background gradient colours
    • Icon
  • Reasonably efficient
  • Returned as a GD object, so you can do what you wish with the result
  • Includes font for creating the famous block text-effect

Usage

To use this library, first download the files required:

Download the Dynamic Userbar PHP Library files here

Look at the test.php file for full use.

include(“userbars.php”);
$generator = new UserBars();
$image = $generator->create(“Test bar! :: “.date(“r”));

Tips

Uncategorized

1 response to Creating Dynamic Userbars in PHP


  1. Pingback: Userbar als Forensignatur » Matthis kleine Welt

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>