Author Topic: Weather Sticker Stopped working.  (Read 255 times)

0 Members and 1 Guest are viewing this topic.

Offline sam2004gp

  • Mount Crawford, Virginia
  • Forecaster
  • *****
  • Posts: 2835
  • Weeeeeeeee!!!!
    • Mount Crawford Weather, VA
Weather Sticker Stopped working.
« on: July 28, 2017, 06:55:27 PM »
I have made no changes to the Weather Sticker here in the forums or on my website, but they both have stopped working.  I appear to be using the last known version of wxgraphic.php which is 6.3.  I have included copies of both of the files straight from my website plus direct links to the them and PHPinfo.  Any idea what is going on or needs fixed?

www.mountcrawfordweather.org/wxgraphic/wxgraphic.php



« Last Edit: July 29, 2017, 08:32:41 AM by sam2004gp »
SAM --->>> http://www.mountcrawfordweather.org
OS WMR-968 with a Dedicated PWS Weather Computer running VWS v13.01 p09


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6228
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Weather Sticker Stopped working.
« Reply #1 on: July 28, 2017, 11:20:51 PM »
The image doesn't show due to an embedded PHP error message
Quote
<b>Warning</b>:  imagecreatefromgif() [function.imagecreatefromgif]: Filename cannot be empty in /home/content/s/a/m/samwarren/html/wxgraphic/wxgraphic.php on line 461

Line 461 in wxgraphic.php is
Code: [Select]
             $ccicon = imagecreatefromgif($vws_icon[$forecast]);

The value for $forecast comes from Line 290:
Code: [Select]
      $forecast = trim(strtoupper($data[13]));
In config.txt you specified
Code: [Select]
// THIS IS NOT A URL!!
// if using WD clientraw.txt supply the path to it.
$data_file_path  = 'http://www.mountcrawfordweather.org/VWS/data.txt'; 
and that should NOT be an URL, but a relative file path like
Code: [Select]
// THIS IS NOT A URL!!
// if using WD clientraw.txt supply the path to it.
$data_file_path  = '../VWS/data.txt'; 

looking at http://www.mountcrawfordweather.org/VWS/data.txt shows
Code: [Select]
11:10pm,7/28/17,69.3,75.7,69.3,95,67.8,29.76,Falling,0.0,NE,2.49,0.0,,6:16am,8:31pm as the contents.
In it, $data[13] = '';
(or null) and that's causing $forecast to be null and so the lookup for an icon fails and the error message gets generated.

In the stickertags template for VWS, the template is supposed to contain
Code: [Select]
^vst143^,^vst142^,^vxv007^,^vxv021^,^vxv019^,^vxv005^,^vxv022^,^vxv023^,^vst140^,^vxv002^,^vxv001^,^vxv121^,^vxv003^,^climate_cconds1^,^vst144^,^vst145^ so it is the ^climate_cconds1^ variable that VWS is not processing correctly.

There's a couple of ways to fix this:
1) get VWS to associate a nearby METAR with ^climate_cconds1^  or
2) comment out the code for icon selection in wxgraphic.php

Hope this helps... and THANKS for providing both URLs and copies of the code.  It makes a 1-pass diagnosis possible :)

Best regards,
Ken

BTW:
Looking at your phpinfo, I see:
allow_url_fopen   On
allow_url_include   On

You should set

allow_url_include = off

in your php.ini -- including URLs can provide a path to execute foreign/malicious code on your website remotely.. not a good thing.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline sam2004gp

  • Mount Crawford, Virginia
  • Forecaster
  • *****
  • Posts: 2835
  • Weeeeeeeee!!!!
    • Mount Crawford Weather, VA
Re: Weather Sticker Stopped working.
« Reply #2 on: July 29, 2017, 08:31:43 AM »
 \:D/ THANK YOU VERY MUCH KEN!!!!  \:D/

You gave me enough info to figure out what I needed to change....

So with all the Wunderground changes lately, many of their functions like NWS alerts, Almanac and Current climate conditions no longer work with VWS. So I had stopped the automatic update of VWS going out to the internet and retrieving that data.  And since VWS is no longer being updated, I was basically S.O.L.   :evil: ](*,)

However your suggestion to see if I could get the Metar Conditions, did get me to thinking.  The recommended VWS tag to use in my input data file was ^climate_cconds1^ but by changing it to the "weather" tag for my Metar Station of KHSD which is ^mtr014KSHD^ brought it back to me. 

Now I only wish, that VWS gave me a tag to output a text version of VWS's Smart Forecast Function, which I use for my weather icon on the my main page, then all would be perfect.   ](*,)

SAM --->>> http://www.mountcrawfordweather.org
OS WMR-968 with a Dedicated PWS Weather Computer running VWS v13.01 p09


Offline sam2004gp

  • Mount Crawford, Virginia
  • Forecaster
  • *****
  • Posts: 2835
  • Weeeeeeeee!!!!
    • Mount Crawford Weather, VA
Re: Weather Sticker Stopped working.
« Reply #3 on: July 29, 2017, 10:12:21 AM »
*** UPDATE  ***

...But then Metar variable I choose above does not always have a value and returns a NULL value on occasion(We have some changing weather today), making my problem occur again. But then I noticed a 2nd variable that VWS returns for the Metar that always has a value but not as "weather condition" accurate as my first variable.  So therefore I added the additional Metar data variable into the array of the Data.txt and then added a clever little if then statement in the PHP code of wxgraphic.php, in case of NULLs. 

.... thank goodness for my coding days of Pascal and Basic from 25+ years ago.

 \:D/
SAM --->>> http://www.mountcrawfordweather.org
OS WMR-968 with a Dedicated PWS Weather Computer running VWS v13.01 p09


 

anything