- This is a php script that will allow you to create a png image (for a signature or just in general) that will dynamically display your Linux server's uptime (days, hours) and load (current, last 5 mins, last 15 mins)
- (static example as you don't need my real uptime/load)
- This script requires that the GD2 Support be enabled for PHP. GD2 is the library that allows creation of images on-the-fly in PHP.
- This script was abandon by me in 2002 and is listed as public domain.
- First off, if GD2 is enabled on your server, simply upload img.php and orig.png into the same directory and then load img.php in your browser. It should work straight off. The settings below are for custimizing your image.
- Changing the $color setting used. if you want to change the color, you simply need to enter a new color settings. The colors are stored in RGB (red,green,blue) format. Use an image editor like MS Paint to get custom the RGB color values, or the following are some common colors:
red: $color = ImageColorAllocate($im, 255, 0, 0);
green: $color = ImageColorAllocate($im, 0, 255, 0);
blue: $color = ImageColorAllocate($im, 0, 0, 255);
black: $color = ImageColorAllocate($im, 0, 0, 0);
white: $color = ImageColorAllocate($im, 255, 255, 255);
- If you use your own original image, and the text doesn't line up anymore, you need to set your own x-axis and y-axis offset on ImageString(). So on mine ImageString($im, 1, 62, 3, $label_uptime, $color); the 62 is my x-offset (or distance in pixels from the left side of image). The 3 is the y-offset (or distance from the top). You can change those numbers on both labels to change the text position.
- To change the font size of the text on the labels, edit the ImageString() like ImageString($im, 1, 62, 3, $label_uptime, $color); change the 1 (1 is smallest) to a different value. The valid values for the default font are 1 to 5.