cloudy

Author Topic: Weather Sticker PHP script v 3.0  (Read 107149 times)

0 Members and 2 Guests are viewing this topic.

Offline gateway2capecod

  • Posts: 1,813
  • Middleborough, Ma. USA
    • Middleborough, Ma. Weather
Re: Weather Sticker PHP script v 3.0
« Reply #315 on: August 25, 2007, 06:02:15 PM »
I noticed that with the wxgraphic...when it displays the "gust"  it is not my maximum high wind gust for the day, but only the gust for most recent time period....where as my avatar that I am using from wxhost, under my username on left, does display the highest gust for today (currently 16mph at time of writting this message)

so there must be something I can edit within the config file of wxgraphic (banner), the question is what do I need to do to make it display my daily highest wind gust within this part of the config file below:

/* write_banner_big: This function writes your values onto the 500X80 banner. */
/******************************************************************************/
function write_banner_big() {

  // 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(90, 50, "$feelslike", 2, 8, $color5, 0);
  break;
  // if heat index >= $heat_index_threshold we'll output it
  case ($heatindex >= $heat_index_threshold):
       $feelslike = "Heat Index: $heatindex$degree_units";
       imagecenteredtext(90, 50, "$feelslike", 2, 8, $color5, 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, 10, "www.gateway2capecod.com", 5, 14, $color5, 0);
  imagecenteredtext(456, 10, "Wareham, Ma.", 2, 7, $color5, 0); 
  imagecenteredtext(250, 35, "$date @ $time", 2, 8, $color5, 0);
  imagecenteredtext(90, 38, "Temp: $temp$degree_units", 5, 14, $color5, 0);
  imagecenteredtext(90, 65, "Humidity: $humidity%", 5, 11, $color5, 0);
  imagecenteredtext(250, 53, "Wind: $winds", 5, 11, $color5, 0);
  imagecenteredtext(250, 67, "Gust: $gust$wind_units", 2, 8, $color5, 0);
  imagecenteredtext(425, 36, "Rain: $raintoday$rain_units", 5, 14, $color5, 0);
  imagecenteredtext(425, 51, "Dew Pt: $dewpt$degree_units", 5, 11, $color5, 0);
  imagecenteredtext(425, 63, "$barom$barom_units $baromtrendwords", 2, 8, $color5, 0);

} /***** end function write_banner_big *****/



thanks, chris

Offline TNETWeather

  • Kevin Reed (KrelvinAZ)
  • Global Moderator
  • Posts: 5,865
  • Gremlins are at work...
  • Mesa, AZ
    • TNET Weather Station - Mesa AZ
Re: Weather Sticker PHP script v 3.0
« Reply #316 on: August 25, 2007, 07:32:34 PM »
Depends on what you are looking for.

The Gusts value is coming from #2 position in the clientraw.txt file for generation of the Wx-Host Avatars.  That is a recent Wind Gust Value.

In the script you are using,

The value $gust is obtained from.

   (float)$gust = round("$data[2]",$wind_prec);

If you want a Max Wind Gust value, that would be value 17.

All you need is Time, Aptitude and Desire ... and you can build just about anything...

Offline carseman

  • Posts: 405
  • Carse of Gowrie, Tayside, Scotland, UK
    • Carseweather
Re: Weather Sticker PHP script v 3.0
« Reply #317 on: August 25, 2007, 07:35:45 PM »
Chris,
For max gust since midnight, try changing line 95 (approx)
from:
(float)$gust = round("$data[2]",$wind_prec);
to
(float)$gust = round("$data[71]",$wind_prec);
I have not tested this, but I think that it will show the max gust since midnight.

Chris

Offline carseman

  • Posts: 405
  • Carse of Gowrie, Tayside, Scotland, UK
    • Carseweather
Re: Weather Sticker PHP script v 3.0
« Reply #318 on: August 25, 2007, 07:39:32 PM »
Kevin,
Snap - we posted at the same time, but I think that your 17 is a typo and that it should be 71  according to your own clientraw checker page.

Chris

Offline TNETWeather

  • Kevin Reed (KrelvinAZ)
  • Global Moderator
  • Posts: 5,865
  • Gremlins are at work...
  • Mesa, AZ
    • TNET Weather Station - Mesa AZ
Re: Weather Sticker PHP script v 3.0
« Reply #319 on: August 25, 2007, 08:36:04 PM »
Yep.

All you need is Time, Aptitude and Desire ... and you can build just about anything...

Offline gateway2capecod

  • Posts: 1,813
  • Middleborough, Ma. USA
    • Middleborough, Ma. Weather
Re: Weather Sticker PHP script v 3.0
« Reply #320 on: August 26, 2007, 01:51:15 PM »
Hello Kevin And Chris,

I made the change from the "2" to the "71" ,...and it is now working ...showing my Maximum gust for the day.

Thanks for the help on this.


Offline carseman

  • Posts: 405
  • Carse of Gowrie, Tayside, Scotland, UK
    • Carseweather
Re: Weather Sticker PHP script v 3.0
« Reply #321 on: August 26, 2007, 02:12:54 PM »
Chris,
Glad we could be of help. Your request has made me think - I have now changed "Gust" to "Gusting to" so that it relects current conditions.

Chris


Offline gateway2capecod

  • Posts: 1,813
  • Middleborough, Ma. USA
    • Middleborough, Ma. Weather
Re: Weather Sticker PHP script v 3.0
« Reply #322 on: August 26, 2007, 03:25:59 PM »
Yes that is not a bad idea, I will probabbly change mine also in the config file

Offline gateway2capecod

  • Posts: 1,813
  • Middleborough, Ma. USA
    • Middleborough, Ma. Weather
Re: Weather Sticker PHP script v 3.0
« Reply #323 on: August 27, 2007, 02:29:40 AM »
instead of it displaying "Gust", or 'Gusting to"...I decided to use "Today's Max Gust"...kinda makes logical sense...."gusting to" kinda would make any viewer to my banner think  that it is currently "gusting to" my highest wind gust of the day, when the actual highest gust could have happened quite a few hours earlier....so if they read it as "today's max gust", then they can only assume that the reading at that time is the highest gust for day so far.


Offline steve26

  • Posts: 249
  • Drôme - France
Re: Weather Sticker PHP script v 3.0
« Reply #324 on: January 09, 2008, 01:41:49 PM »
Eureka  :D :D

I have found the problem.  In the switch statement between lines 509 and 539 of wxgraphic.php,
sticker type was being evaluated using $type. If the instances of type within the switch are changed to
$_REQUEST["type"] then all works now.
I have zipped up a patched version (including Kevin's fix)  of wxgraphic.php at
 www.carseweather.co.uk/wxfix/wx61fix.zip
This link will be removed once Larry (Anole) produces an official patched version.

Chris

Thank you for this file !
Since Anole as not updated his script (anyone asks him ?), I use your script which works perfectly :-)

Thank to Krelvinaz too, for his highilight on the need of clientraw.txt full path in config.txt :
Code: [Select]
$data_file_path  = '/www/vhosts/weather/clientraw.txt';
Examples :





« Last Edit: January 09, 2008, 01:45:37 PM by steve26 »

Offline Fox_Of_The_Wind

  • Anthony
  • Posts: 1,166
  • C:\DOS C:\DOS\RUN RUN\DOS\RUN
  • De Soto Wisconsin USA
    • De Soto Valley Weather
Re: Weather Sticker PHP script v 3.0
« Reply #325 on: February 14, 2008, 05:48:21 PM »
I just upgraded my sticker. but it is not working right.
http://www.desotowiwx.com/wxgraphic/index.php

Anyone know what is going on?
« Last Edit: February 14, 2008, 08:35:46 PM by Fox_Of_The_Wind »


Offline niko

  • syzygy
  • Global Moderator
  • Posts: 22,156
  • Crystal Ball broken! Please post the URL.
  • Northern California, U.S.A.
    • http://www.realweatherstation.com
Re: Weather Sticker PHP script v 3.0
« Reply #326 on: February 14, 2008, 06:07:28 PM »
See the posting above yours. Are you using the code downloaded from carseman as linked in that post?

Offline Fox_Of_The_Wind

  • Anthony
  • Posts: 1,166
  • C:\DOS C:\DOS\RUN RUN\DOS\RUN
  • De Soto Wisconsin USA
    • De Soto Valley Weather
Re: Weather Sticker PHP script v 3.0
« Reply #327 on: February 14, 2008, 06:12:02 PM »
that is strange. It worked fine on my local server but out in on WWW it gets scared. lol. It looks like that was it. Thanks niko


Offline niko

  • syzygy
  • Global Moderator
  • Posts: 22,156
  • Crystal Ball broken! Please post the URL.
  • Northern California, U.S.A.
    • http://www.realweatherstation.com
Re: Weather Sticker PHP script v 3.0
« Reply #328 on: February 14, 2008, 06:16:29 PM »
Yes, looks OK now.

Offline Budgie

  • Martin
  • Global Moderator
  • Posts: 4,956
  • WML Station: WD00934 CWOP: CW7959
  • Isle of Lewis, Scotland
    • Hebrides-Weather
Re: Weather Sticker PHP script v 3.0
« Reply #329 on: March 04, 2008, 10:18:10 PM »
I'm looking for a little advice.
I'm trying to change the fonts on my graphics but can't seem to get it to recognise the new font.  #-o

I downloaded a tahoma.ttf file, uploaded it to the WXgraphics folder on the site and changed the wxgraphic.php and config.txt files to read $font_file = './tahoma.ttf'; but nothing has changed on the graphics.

I see there is a note on Anole's site saying "Be sure to upload the font file as binary!" but how do I do this when I'm using Dreamweaver's built-in FTP to upload the file? Or does it upload in binary anyway?

Any ideas about where I'm going wrong? Or is it just a case that my host server doesn't recognise .ttf files?

Cheers,

Martin.  :wink:

 

cumulus