This is a simple PHP banner script that uses standard GD and the default fonts (5 of them), OR TrueType Fonts (you need to have both support and fonts available). The TTF are clearer and smoother looking.
I tested this on a PHP5 based server, so I'm not sure if it will work with PHP4.
This script generates an image each time it is called by reading the current realtime.txt file that is on the server.
Sample Output:
Example is shown with TTF fonts ON (or set to yes).
Standard GD fonts or TTF Fonts
Control over which fonts the script will use is determined in the settings area with 2 settings:
Code: Select all
$SITE['fontdir'] = "fonts/"; # must contain ttf font files!
$SITE['usettf'] = "yes"; # Set to No to use default fonts
I used 3 different fonts:
Code: Select all
// Path to our font file
$font1 = $SITE['fontdir'] . "arialbd.ttf"; # Arial Bold
$font2 = $SITE['fontdir'] . "arial.ttf"; # Arial
$font3 = $SITE['fontdir'] . "verdana.ttf"; # Verdana
The biggest difference is that with TTF fonts, you can use different sizes with the same font. GD fonts all 5 of them are different fonts at different sizes.
Usage:
The script is a single script that should work right out of the box (with TTF fonts turned off) if you place it in the same directory as where your realtime.txt file is being uploaded.
You will want to change the station name and the unit settings if you use different units for rain, temp wind and baro.
The version number which is not send out in the realtime.txt file is also a manual setting in the script.
Settings:
The variables that can adjust the script are:
Code: Select all
############################################################################
# CONFIGURATION INFORMATION
############################################################################
$SITE['version'] = "0.1";
$SITE['hloc'] = "./";
$SITE['datafile'] = "realtime.txt";
$SITE['fontdir'] = "fonts/"; # must contain ttf font files!
$SITE['usettf'] = "yes"; # Set to No to use default fonts
$SITE['format'] = "png"; # Options: jpeg gif png
$SITE['dateiso'] = "no";
$SITE['image_width'] = 100;
$SITE['image_height'] = 100;
$SITE['sitename'] = "Mesa AZ USA";
$SITE['cumulusver'] = "1.8.2";
$SITE['tempunit'] = "°F";
$SITE['rainunit'] = "in";
$SITE['barounit'] = " mb";
$SITE['windunit'] = " mph";
Project Page and Downloads
http://cumulus.tnetweather.com/projects/phpgdavatar