= to this value $heat_index_threshold = '99'; // CURRENT CONDITIONS ICON: include a current conditions icon on the graphic // NOTE! currently only supported if you are using Weather Display // clientraw.txt or VWS for your data file. // if $curr_cond_icon is set to any value other than "yes" the icon will not // be included. $curr_cond_icon = 'no'; /***** ICON PLACEMENT: this section defines where the current *****/ /***** conditions/forecast icon will be placed if you are using it *****/ // $default_icon_x: x coordinate on default image of the upper left most pixel of icon // $default_icon_y: y coordinate on default image of the upper left most pixel of icon $default_icon_x = '95'; $default_icon_y = '40'; $standardbanner_icon_x = '2'; $standardbanner_icon_y = '2'; $banner_icon_x = '15'; $banner_icon_y = '16'; $avatar_icon_x = '2'; $avatar_icon_y = '2'; $citybanner_icon_x = '15'; $citybanner_icon_y = '16'; $carsonnow_icon_x = '0'; $carsonnow_icon_y = '0'; $carsonnow1_icon_x = '0'; $carsonnow1_icon_y = '28'; $whitebanner_icon_x = '0'; $whitebanner_icon_y = '0'; $news_icon_x = '0'; $news_icon_y = '0'; $small_icon_x = '1000'; $small_icon_y = '1000'; /****************************************************************************/ /*************************** Color Definitions *****************************/ /****************************************************************************/ // These are the color definitions for the images. // imagecolorallocate(image, red, green, blue); // where: // image = image variable. Will always be "$img". // red = red component 0-255 // green = green component 0-255 // blue = blue component 0-255 function define_colors() { global $img, $red, $green, $blue, $black, $yellow, $white, $trans_color, $anti_alias; $red = imagecolorallocate($img,255,0,0); // RED $green = imagecolorallocate($img,0,128,0); // GREEN $blue = imagecolorallocate($img,0,0,255); // BLUE $black = imagecolorallocate($img,0,0,0); // BLACK $yellow= imagecolorallocate($img,255,255,0); // YELLOW $white = imagecolorallocate($img,255,255,255); // WHITE /***** Transparency settings *****/ // if using a transparent color set it here. the RGB value should match the // color value of your images background, ie the color you want to be // transparent. // This is only supported for gif and png images! // IMPORTANT! don't set the pallete tranparency in your source image with // your image editor! You'll get strange results if you do. // you may want to set $anti_alias to 'off' below to avoid the problems // anti-aliasing can introduce with different background colors. // See README.txt for more info on using transparency // uncomment the two lines below to set transparency // //$trans_color = imagecolorallocate($img,250,250,250); //$trans_color = imagecolortransparent($img,$trans_color); // Transparency can be problematic with the anti-aliasing that occurs // by default with TrueType fonts in GD. To help avoid the problems that can // occur with anti-aliasing over different color backgrounds you can turn it // off with this parameter. The tradeoff is that your text will not look as // good. // To turn off TrueType anti-aliasing set "$anti_alias = 'off'; $anti_alias = 'on'; } // end function define_colors /****************************************************************************/ /************************* DATA WRITING FUNCTIONS ***************************/ /****************************************************************************/ // Below are the functions that write the actual data onto the image. I've // broken them out into the config.txt file to make it easier to modify. // write_default: writes data onto the default image // write_banner: writes data onto the banner // write_banner_big: writes data onto the big banner // write_avatar: writes data onto the avatar image // // All data is written onto the image using the funcion: // imagecenteredtext($x, $y, $text, $size, $ttfsize, $color, $angle); // where: // $x = x coordinate where the text will be centered // $y = y coordinate where the text will be centered // $text = the text to be written // $size = font size for built-in GD fonts (1,2,3,4, or 5) // $ttfsize = font size for ttf fonts. Use just like you would in a word processor // $color = color as defined in the allocate colors section below // $angle = for ttf fonts, determines the angle for the text. // you must pass all parameters even if you aren't using them. if you are not // using a parameter put '' in its place. /*****************************************************************************/ /***** write_default: This function writes your values onto the default. *****/ /*****************************************************************************/ function write_default() { // 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 $red, $green, $blue, $black, $white, $yellow, $date, $time, $temp, $degree_units, $winds, $wind_units, $gust, $raintoday, $rain_units, $shortrain, $barom, $barom_units, $baromtrendwords, $dewpt, $humidity, $heatindex, $heat_index_threshold, $windchill, $wind_chill_threshold, $banner_icon_x, $banner_icon_y, $anti_alias, $warnings, $smallwarnings, $sunrise, $sunset, $fcasttemphi, $fcasttemplo; // 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 and the difference is more than 5 degrees,we'll output it case (($windchill <= $wind_chill_threshold) and ($temp - $windchill >= 5)); $feelslike = "Wind Chill: $windchill"; imagecenteredtext(75, 74, "$feelslike", 1, 8.5, $red, 0); break; // if heat index >= $heat_index_threshold and the difference is more than 5 degrees,we'll output it case (($heatindex >= $heat_index_threshold) and ($temp + $heatindex >= 5)); $feelslike = "Heat Index: $heatindex"; imagecenteredtext(75, 74, "$feelslike", 1, 8, $red, 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 if ($raintoday !== "") { imagecenteredtext(45, 96, "Precip today:$shortrain", 1, 8, $red, 0); imagecenteredtext(120, 96, "RH:$humidity%", 1, 9, $black, 0); } else { imagecenteredtext(75, 96, "Humidity: $humidity%", 5, 8, $black, 0); } imagecenteredtext(75, 25, "Updated $time $date", 2, 9, $green, 0); imagecenteredtext(55, 63, " $temp", 6, 21, $black, 0); imagecenteredtext(74, 37, " $warnings", 8.5, 8.5, $red, 0); imagecenteredtext(75, 84, "Wind: $winds", 3, 9, $black, 0); //imagecenteredtext(75, 96, "Humidity: $humidity%", 5, 8, $black, 0); imagecenteredtext(75, 107, "Barometer is $baromtrendwords", 2, 8, $black, 0); imagecenteredtext(75, 121,"Forecast: $fcasttemphi / $fcasttemplo", 2, 12, $blue, 0); imagecenteredtext(42, 136, "$sunrise", 5, 10, $black, 0); imagecenteredtext(116, 136, "$sunset", 5, 10, $black, 0); } /***** end function write_default *****/ /******************************************************************************/ /*** write_standardbanner: This function writes your values onto the 468X60 banner. ***/ /******************************************************************************/ function write_standardbanner() { // 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 $red, $green, $blue, $black, $white, $yellow, $date, $time, $temp, $degree_units, $winds, $wind_units, $gust, $raintoday, $rain_units, $shortrain, $barom, $barom_units, $baromtrendwords, $dewpt, $humidity, $heatindex, $heat_index_threshold, $windchill, $wind_chill_threshold, $banner_icon_x, $banner_icon_y, $anti_alias, $warnings, $smallwarnings, $sunrise, $sunset, $fcasttemphi, $fcasttemplo; // 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 and the difference is more than 5 degrees,we'll output it case (($windchill <= $wind_chill_threshold) and ($temp - $windchill >= 5)); $feelslike = "Wind Chill: $windchill"; imagecenteredtext(73, 48, "$feelslike", 1, 8.5, $red, 0); break; // if heat index >= $heat_index_threshold and the difference is more than 5 degrees,we'll output it case (($heatindex >= $heat_index_threshold) and ($temp + $heatindex >= 5)); $feelslike = "Heat Index: $heatindex"; imagecenteredtext(73, 48, "$feelslike", 1, 8, $red, 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, $green, 0); imagecenteredtext(422, 10, "Click For More", 2, 7, $red, 0); imagecenteredtext(234, 24, "$date @ $time", 1, 7, $green, 0); imagecenteredtext(70, 25, "Temp: $temp$degree_units", 5, 11, $black, 0); imagecenteredtext(70, 50, "Humidity: $humidity%", 5, 9, $black, 0); imagecenteredtext(234, 36, "Wind: $winds", 5, 11, $black, 0); imagecenteredtext(234, 48, "Gust: $gust$wind_units", 2, 7, $black, 0); imagecenteredtext(400, 25, "Precip today:$shortrain", 5, 11, $blue, 0); imagecenteredtext(400, 38, "Dew Pt: $dewpt$degree_units", 5, 9, $black, 0); imagecenteredtext(400, 50, "$barom$barom_units $baromtrendwords", 2, 7, $black, 0); } // end function write_standardbanner /******************************************************************************/ /* write_citybanner: This function writes your values onto the 500X90 citybanner. */ /******************************************************************************/ function write_citybanner() { // 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 $red, $green, $blue, $black, $white, $yellow, $date, $time, $temp, $degree_units, $winds, $wind_units, $gust, $raintoday, $rain_units, $shortrain, $barom, $barom_units, $baromtrendwords, $dewpt, $humidity, $heatindex, $heat_index_threshold, $windchill, $wind_chill_threshold, $banner_icon_x, $banner_icon_y, $anti_alias, $warnings, $smallwarnings, $sunrise, $sunset, $fcasttemphi, $fcasttemplo; // 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 and the difference is more than 5 degrees,we'll output it case (($windchill <= $wind_chill_threshold) and ($temp - $windchill >= 5)); $feelslike = "Wind Chill: $windchill"; imagecenteredtext(73, 48, "$feelslike", 1, 8.5, $red, 0); break; // if heat index >= $heat_index_threshold and the difference is more than 5 degrees,we'll output it case (($heatindex >= $heat_index_threshold) and ($temp + $heatindex >= 5)); $feelslike = "Heat Index: $heatindex"; imagecenteredtext(73, 48, "$feelslike", 1, 8, $red, 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(250, 18, "Carson City Weather", 1, 17, $blue, 0); imagecenteredtext(250, 32, "Updated at $time on $date", 1, 10, $black, 0); imagecenteredtext(72, 14, " Temperature", 1, 11, $black, 0); imagecenteredtext(72, 38, " $temp", 1, 21, $black, 0); imagecenteredtext(78, 87, "www.carsonweather.com", 1, 10, $white, 0); imagecenteredtext(250, 87, "Click for more details", 1, 10, $white, 0); imagecenteredtext(250, 50, "Wind $winds", 1, 11, $black, 0); imagecenteredtext(250, 70, " $warnings", 1, 13, $red, 0); imagecenteredtext(73, 59,"Today's Forecast", 1, 10, $yellow, 0); imagecenteredtext(73, 74,"High:$fcasttemphi Low:$fcasttemplo", 1, 12, $yellow, 0); if ($raintoday !== "") { imagecenteredtext(428, 15, "Precip today:$shortrain", 1, 13, $red, 0); } imagecenteredtext(430, 28, "Humidity: $humidity%", 1, 12, $black, 0); imagecenteredtext(430, 43, "Dew Point: $dewpt", 1, 12, $black, 0); imagecenteredtext(430, 57, "Pressure is $barom", 1, 11, $black, 0); imagecenteredtext(430, 70, " and $baromtrendwords", 1, 11, $black, 0); imagecenteredtext(378, 87, "Sunrise $sunrise", 1, 8, $white, 0); imagecenteredtext(460, 87, "Sunset $sunset", 1, 8, $white, 0); } /***** end function write_citybanner *****/ /******************************************************************************/ /* write_banner: This function writes your values onto the 500X90 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 $red, $green, $blue, $black, $white, $yellow, $date, $time, $temp, $degree_units, $winds, $wind_units, $gust, $raintoday, $rain_units, $shortrain, $barom, $barom_units, $baromtrendwords, $dewpt, $humidity, $heatindex, $heat_index_threshold, $windchill, $wind_chill_threshold, $banner_icon_x, $banner_icon_y, $anti_alias, $warnings, $smallwarnings, $sunrise, $sunset, $fcasttemphi, $fcasttemplo; // 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 and the difference is more than 5 degrees,we'll output it case (($windchill <= $wind_chill_threshold) and ($temp - $windchill >= 5)); $feelslike = "Wind Chill: $windchill"; imagecenteredtext(73, 48, "$feelslike", 1, 8.5, $red, 0); break; // if heat index >= $heat_index_threshold and the difference is more than 5 degrees,we'll output it case (($heatindex >= $heat_index_threshold) and ($temp + $heatindex >= 5)); $feelslike = "Heat Index: $heatindex"; imagecenteredtext(73, 48, "$feelslike", 1, 8, $red, 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(250, 18, "Carson City Weather", 1, 17, $blue, 0); imagecenteredtext(250, 32, "Updated at $time on $date", 1, 10, $black, 0); imagecenteredtext(72, 14, " Temperature", 1, 11, $black, 0); imagecenteredtext(72, 38, " $temp", 1, 21, $black, 0); imagecenteredtext(78, 87, "www.carsonweather.com", 1, 10, $white, 0); imagecenteredtext(250, 87, "Click for more details", 1, 10, $white, 0); imagecenteredtext(250, 50, "Wind $winds", 1, 11, $black, 0); imagecenteredtext(250, 70, " $warnings", 1, 13, $red, 0); imagecenteredtext(73, 59,"Today's Forecast", 1, 10, $yellow, 0); imagecenteredtext(73, 74,"High:$fcasttemphi Low:$fcasttemplo", 1, 12, $yellow, 0); if ($raintoday !== "") { imagecenteredtext(428, 15, "Precip today:$shortrain", 1, 13, $red, 0); } imagecenteredtext(430, 28, "Humidity: $humidity%", 1, 12, $black, 0); imagecenteredtext(430, 43, "Dew Point: $dewpt", 1, 12, $black, 0); imagecenteredtext(430, 57, "Pressure is $barom", 1, 11, $black, 0); imagecenteredtext(430, 70, " and $baromtrendwords", 1, 11, $black, 0); imagecenteredtext(378, 87, "Sunrise $sunrise", 1, 8, $white, 0); imagecenteredtext(460, 87, "Sunset $sunset", 1, 8, $white, 0); } /***** end function write_banner *****/ /*****************************************************************************/ /***** write_carsonnow: This function writes your values onto the carsonnow graphic. *****/ /*****************************************************************************/ function write_carsonnow() { // 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 $red, $green, $blue, $black, $white, $yellow, $date, $time, $temp, $degree_units, $winds, $wind_units, $gust, $raintoday, $rain_units, $shortrain, $barom, $barom_units, $baromtrendwords, $dewpt, $humidity, $heatindex, $heat_index_threshold, $windchill, $wind_chill_threshold, $banner_icon_x, $banner_icon_y, $anti_alias, $warnings, $smallwarnings, $sunrise, $sunset, $fcasttemphi, $fcasttemplo; // 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 and the difference is more than 5 degrees,we'll output it case (($windchill <= $wind_chill_threshold) and ($temp - $windchill >= 5)); $feelslike = "Wind Chill: $windchill"; //imagecenteredtext(40, 48, "$feelslike", 1, 8.5, $red, 0); break; // if heat index >= $heat_index_threshold and the difference is more than 5 degrees,we'll output it case (($heatindex >= $heat_index_threshold) and ($temp + $heatindex >= 5)); $feelslike = "Heat Index: $heatindex"; imagecenteredtext(40, 48, "$feelslike", 1, 8, $red, 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 // $image, $x, $y, $text, $size, $color, $font, $angle // draw the rest of the data on the image if ($raintoday !== "") { imagecenteredtext(83, 47, "Precip:$shortrain", 1, 8, $red, 0); imagecenteredtext(150, 47, "RH:$humidity%", 1, 9, $black, 0); } else { imagecenteredtext(125, 47, "Humidity:$humidity%", 1, 9, $black, 0); } imagecenteredtext(40, 58, "click for more...", 1, 8, $blue, 0); //imagecenteredtext(90, 12, "Observed at $time on $date", 2, 9, $black, 0); imagecenteredtext(100, 14, "Carson City Weather", 1, 11, $black, 0); imagecenteredtext(28, 46, "$temp", 1, 19, $green, 0); imagecenteredtext(110, 26, "$warnings", 1, 8, $red, 0); imagecenteredtext(118, 36, "Wind:$winds", 1, 8, $black, 0); //imagecenteredtext(68, 47, "$shortrain", 1, 8, $red, 0); //imagecenteredtext(90, 24, "Forecast--High:$fcasttemphi Low:$fcasttemplo", 1, 10, $black, 0); //imagecenteredtext(125, 47, "Humidity: $humidity%", 1, 9, $black, 0); imagecenteredtext(125, 58, "Barometer is $baromtrendwords", 1, 8, $black, 0); } /***** end function write_carsonnow *****/ /*****************************************************************************/ /***** write_carsonnow1: This function writes your values onto the carsonnow1 graphic. *****/ /*****************************************************************************/ function write_carsonnow1() { // 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 $red, $green, $blue, $black, $white, $yellow, $date, $time, $temp, $degree_units, $winds, $wind_units, $gust, $raintoday, $rain_units, $shortrain, $barom, $barom_units, $baromtrendwords, $dewpt, $humidity, $heatindex, $heat_index_threshold, $windchill, $wind_chill_threshold, $banner_icon_x, $banner_icon_y, $anti_alias, $warnings, $smallwarnings, $sunrise, $sunset, $fcasttemphi, $fcasttemplo; // 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 and the difference is more than 5 degrees,we'll output it case (($windchill <= $wind_chill_threshold) and ($temp - $windchill >= 5)); $feelslike = "Wind Chill: $windchill"; imagecenteredtext(75, 60, "$feelslike", 1, 8, $red, 0); break; // if heat index >= $heat_index_threshold and the difference is more than 5 degrees,we'll output it case (($heatindex >= $heat_index_threshold) and ($temp + $heatindex >= 5)); $feelslike = "Heat Index: $heatindex"; imagecenteredtext(75, 65, "$feelslike", 1, 8, $red, 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 // $image, $x, $y, $text, $size, $color, $font, $angle // draw the rest of the data on the image if ($raintoday !== "") { imagecenteredtext(83, 47, "$shortrain", 1, 8, $red, 0); imagerighttext(150, 47, "RH:$humidity%", 1, 9, $black, 0); } else { imagerighttext(150, 47, "Humidity:$humidity%", 1, 9, $black, 0); } //imagecenteredtext(95, 12, "Observed at $time on $date", 2, 9, $black, 0); imagecenteredtext(75, 14, "Carson City Weather", 1, 11, $black, 0); imagecenteredtext(46, 49, "$temp", 1, 19, $green, 0); imagecenteredtext(75, 27, "$warnings", 1, 8, $red, 0); imagecenteredtext(75, 72, "Wind:$winds", 1, 10, $black, 0); //imagecenteredtext(68, 47, "$shortrain", 1, 8, $red, 0); //imagecenteredtext(75, 75, "Forecast--High:$fcasttemphi Low:$fcasttemplo", 1, 10, $black, 0); // imagecenteredtext(75, 82,"Forecast: $fcasttemphi / $fcasttemplo", 2, 12, $blue, 0); //imagecenteredtext(145, 49, "Humidity: $humidity%", 1, 9, $black, 0); imagecenteredtext(75, 86, "Barometer is $baromtrendwords", 1, 8, $black, 0); imagecenteredtext(40, 100, "click for more...", 1, 8, $blue, 0); } /***** end function write_carsonnow1 ***** /*****************************************************************************/ /***** write_whitebanner: This function writes your values onto the whitebanner graphic. *****/ /*****************************************************************************/ function write_whitebanner() { // 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 $red, $green, $blue, $black, $white, $yellow, $date, $time, $temp, $degree_units, $winds, $wind_units, $gust, $raintoday, $rain_units, $shortrain, $barom, $barom_units, $baromtrendwords, $dewpt, $humidity, $heatindex, $heat_index_threshold, $windchill, $wind_chill_threshold, $banner_icon_x, $banner_icon_y, $anti_alias, $warnings, $smallwarnings, $sunrise, $sunset, $fcasttemphi, $fcasttemplo; // 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 and the difference is more than 5 degrees,we'll output it case (($windchill <= $wind_chill_threshold) and ($temp - $windchill >= 5)); $feelslike = "Wind Chill: $windchill"; //imagecenteredtext(40, 48, "$feelslike", 1, 8.5, $red, 0); break; // if heat index >= $heat_index_threshold and the difference is more than 5 degrees,we'll output it case (($heatindex >= $heat_index_threshold) and ($temp + $heatindex >= 5)); $feelslike = "Heat Index: $heatindex"; imagecenteredtext(40, 48, "$feelslike", 1, 8, $red, 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 // $image, $x, $y, $text, $size, $color, $font, $angle // draw the rest of the data on the image if ($raintoday !== "") { imagecenteredtext(85, 47, "Precip:$shortrain", 1, 8, $red, 0); imagecenteredtext(148, 47, "RH:$humidity%", 1, 9, $black, 0); } else { imagecenteredtext(125, 47, "Humidity:$humidity%", 1, 9, $black, 0); } imagecenteredtext(40, 58, "click for more...", 1, 8, $blue, 0); //imagecenteredtext(90, 12, "Observed at $time on $date", 2, 9, $black, 0); imagecenteredtext(100, 14, "Carson City Weather", 1, 11, $black, 0); imagecenteredtext(28, 46, "$temp", 1, 19, $green, 0); imagecenteredtext(110, 26, "$warnings", 1, 8, $red, 0); imagecenteredtext(118, 36, "Wind:$winds", 1, 8, $black, 0); //imagecenteredtext(68, 47, "Precip:$shortrain", 1, 8, $red, 0); //imagecenteredtext(90, 24, "Forecast--High:$fcasttemphi Low:$fcasttemplo", 1, 10, $black, 0); //imagecenteredtext(125, 47, "Humidity: $humidity%", 1, 9, $black, 0); imagecenteredtext(125, 58, "Barometer is $baromtrendwords", 1, 8, $black, 0); } /***** end function write_whitebanner *****/ /*****************************************************************************/ /***** write_news: This function writes your values onto the news graphic. *****/ /*****************************************************************************/ function write_news() { // 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 $red, $green, $blue, $black, $white, $yellow, $date, $time, $temp, $degree_units, $winds, $wind_units, $gust, $raintoday, $rain_units, $shortrain, $barom, $barom_units, $baromtrendwords, $dewpt, $humidity, $heatindex, $heat_index_threshold, $windchill, $wind_chill_threshold, $banner_icon_x, $banner_icon_y, $anti_alias, $warnings, $smallwarnings, $sunrise, $sunset, $fcasttemphi, $fcasttemplo; // 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 and the difference is more than 5 degrees,we'll output it case (($windchill <= $wind_chill_threshold) and ($temp - $windchill >= 5)); $feelslike = "Wind Chill: $windchill"; //imagecenteredtext(40, 48, "$feelslike", 1, 8.5, $red, 0); break; // if heat index >= $heat_index_threshold and the difference is more than 5 degrees,we'll output it case (($heatindex >= $heat_index_threshold) and ($temp + $heatindex >= 5)); $feelslike = "Heat Index: $heatindex"; imagecenteredtext(40, 48, "$feelslike", 1, 8, $red, 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 // $image, $x, $y, $text, $size, $color, $font, $angle // draw the rest of the data on the image if ($raintoday !== "") { imagecenteredtext(85, 47, "Precip today:$shortrain", 1, 8, $red, 0); imagecenteredtext(148, 47, "RH:$humidity%", 1, 9, $black, 0); } else { imagecenteredtext(125, 47, "Humidity:$humidity%", 1, 9, $black, 0); } imagecenteredtext(40, 58, "click for more...", 1, 8, $blue, 0); //imagecenteredtext(90, 12, "Observed at $time on $date", 2, 9, $black, 0); imagecenteredtext(100, 14, "Carson City Weather", 1, 11, $black, 0); imagecenteredtext(28, 46, "$temp", 1, 19, $green, 0); imagecenteredtext(110, 26, "$warnings", 1, 8, $red, 0); imagecenteredtext(118, 36, "Wind:$winds", 1, 8, $black, 0); //imagecenteredtext(68, 47, "Precip today:$shortrain", 1, 8, $red, 0); //imagecenteredtext(90, 24, "Forecast--High:$fcasttemphi Low:$fcasttemplo", 1, 10, $black, 0); //imagecenteredtext(125, 47, "Humidity: $humidity%", 1, 9, $black, 0); imagecenteredtext(125, 58, "Barometer is $baromtrendwords", 1, 8, $black, 0); } /***** end function write_news *****/ /******************************************************************************/ /*** write_small: This function writes your values onto the small sticker. ***/ /******************************************************************************/ function write_small() { // 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 $red, $green, $blue, $black, $white, $yellow, $date, $time, $temp, $degree_units, $winds, $wind_units, $gust, $raintoday, $rain_units, $shortrain, $barom, $barom_units, $baromtrendwords, $dewpt, $humidity, $heatindex, $heat_index_threshold, $windchill, $wind_chill_threshold, $banner_icon_x, $banner_icon_y, $anti_alias, $warnings, $smallwarnings, $sunrise, $sunset, $fcasttemphi, $fcasttemplo; // 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 and the difference is more than 5 degrees,we'll output it case (($windchill <= $wind_chill_threshold) and ($temp - $windchill >= 5)); $feelslike = "Wind Chill: $windchill"; // imagecenteredtext(73, 48, "$feelslike", 1, 8.5, $red, 0); break; // if heat index >= $heat_index_threshold and the difference is more than 5 degrees,we'll output it case (($heatindex >= $heat_index_threshold) and ($temp + $heatindex >= 5)); $feelslike = "Heat Index: $heatindex"; // imagecenteredtext(73, 48, "$feelslike", 1, 8, $red, 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(48, 12, " CarsonWeather.com", 1, 8, $white, 0); imagecenteredtext(48, 25, " $date $time", 1, 9, $white, 0); imagecenteredtext(50, 60, " $temp", 1, 19, $white, 0); imagecenteredtext(50, 35, " $smallwarnings", 1, 7, $yellow, 0); imagecenteredtext(50, 72, "Wind:$winds", 1, 9, $white, 0); } // end function write_small /*****************************************************************************/ /***** write_avatar: This function writes your values onto the avatar. *****/ /*****************************************************************************/ function write_avatar() { // 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 $red, $green, $blue, $black, $white, $yellow, $date, $time, $temp, $degree_units, $winds, $wind_units, $gust, $raintoday, $rain_units, $shortrain, $barom, $barom_units, $baromtrendwords, $dewpt, $humidity, $heatindex, $heat_index_threshold, $windchill, $wind_chill_threshold, $banner_icon_x, $banner_icon_y, $anti_alias, $warnings, $smallwarnings, $sunrise, $sunset, $fcasttemphi, $fcasttemplo; // 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 and the difference is more than 5 degrees,we'll output it case (($windchill <= $wind_chill_threshold) and ($temp - $windchill >= 5)); $feelslike = "Wind Chill: $windchill"; imagecenteredtext(50, 49, "$feelslike", 1, 8.5, $red, 0); break; // if heat index >= $heat_index_threshold and the difference is more than 5 degrees,we'll output it case (($heatindex >= $heat_index_threshold) and ($temp + $heatindex >= 5)); $feelslike = "Heat Index: $heatindex"; imagecenteredtext(50, 49, "$feelslike", 1, 8, $red, 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(65, 10, "CarsonWeather", 2, 7, $green, 0); imagecenteredtext(65, 20, "Current Wx", 2, 8, $green, 0); imagecenteredtext(50, 40, "$temp", 5, 14, $black, 0); imagecenteredtext(50, 60, "Precip today:$shortrain", 3, 9, $blue, 0); imagecenteredtext(50, 72, "$winds", 3, 9, $black, 0); imagecenteredtext(50, 82, "$barom$barom_units", 1, 8, $black, 0); imagecenteredtext(50, 96, "$date $time", 1, 7, $green, 0); } /***** end function write_avatar *****/ /************************* END WRITING FUNCTIONS ******************************/ /******************************************************/ /************ End of User Configuration ***************/ /******************************************************/ ?>