Mick,
Great! You’re on your way to making a weather graphic set.
You modify the text for each type of graphic by editing (carefully) the code in config.txt.
Each type of banner (default, avatar, banner, banner_big) has a small function that is called to create/annotate that particular size graphic. For example, the banner graphic is controlled by this
/******************************************************************************/
/*** write_banner: This function writes your values onto the 468X60 banner. ***/
/******************************************************************************/
function write_banner() {
// let's start by defining some global variables that will be passed between
// functions. This is kind of clunky!
// NOTE: IF YOU ADD ADDITIONAL COLORS YOU'LL NEED TO ADD THEM HERE TOO!
global $color1, $color2, $color3, $color4, $color5, $date, $time, $temp,
$degree_units, $winds, $wind_units, $gust, $raintoday, $rain_units,
$barom, $barom_units, $baromtrendwords, $dewpt, $humidity, $heatindex,
$heat_index_threshold, $windchill, $wind_chill_threshold,
$banner_icon_x, $banner_icon_y, $anti_alias;
// this section does the heat index and wind chill
// it figures out what to show, wind chill, heatindex or nothing
// depending upon your settings
switch (TRUE){
// if windchill is <= $wind_chill_threshold we'll output it
case ($windchill <= $wind_chill_threshold):
$feelslike = "Wind Chill: $windchill$degree_units";
imagecenteredtext(70, 38, "$feelslike", 2, 7, $color3, 0);
break;
// if heat index >= $heat_index_threshold we'll output it
case ($heatindex >= $heat_index_threshold):
$feelslike = "Heat Idx: $heatindex$degree_units";
imagecenteredtext(70, 38, "$feelslike", 2, 7, $color1, 0);
break;
} // end switch
// this section controls what is written to the image, where it is written.
// see the explanation above for details on what each parameter represents
imagecenteredtext(90, 12, "A Title Here", 5, 10, $color2, 0);
imagecenteredtext(422, 10, "Click For More", 2, 7, $color1, 0);
imagecenteredtext(234, 24, "$date @ $time", 1, 7, $color2, 0);
imagecenteredtext(70, 25, "Temp: $temp$degree_units", 5, 11, $color4, 0);
imagecenteredtext(70, 50, "Humidity: $humidity%", 5, 9, $color4, 0);
imagecenteredtext(234, 36, "Wind: $winds", 5, 11, $color4, 0);
imagecenteredtext(234, 48, "Gust: $gust$wind_units", 2, 7, $color4, 0);
imagecenteredtext(400, 25, "Rain: $raintoday$rain_units", 5, 11, $color3, 0);
imagecenteredtext(400, 38, "Dew Pt: $dewpt$degree_units", 5, 9, $color4, 0);
imagecenteredtext(400, 50, "$barom$barom_units $baromtrendwords", 2, 7, $color4, 0);
} // end function write_banner
The strings in the third arguments to the imagecenteredtext() function calls are what you can change. The first two arguments are the X and Y position for the middle of the sentence to be displayed. X=0 is left side, Y=0 is top of image, with X and Y increasing to the X=width, Y=height for the size of the graphic.
You can replace the underlying graphic background with your own image (since you’ve chosen .gif, the default images are named
default.gif
avatar.gif
banner.gif
banner_big.gif
Remember to keep them the same size (height/width) when you replace them.
Hope this helps.
Best regards,
Ken