Author Topic: wxmetar.php - icons no longer appearing  (Read 568 times)

0 Members and 1 Guest are viewing this topic.

Offline tshattuck

  • Forecaster
  • *****
  • Posts: 337
    • Your Local Weather - Clay, NY
wxmetar.php - icons no longer appearing
« on: July 20, 2015, 11:45:03 PM »
Hello:
I am now using the new 86px x 86px Dual Image Icons and in page wxmetar.php no icons appear. The icons appear okay on my home page and on the Local Forecasts page - wxforecast.php.
What do I need to change to get the wxmetar.php script to use the new icons?

Any assistance is greatly appreciated.

Thanks
« Last Edit: July 20, 2015, 11:46:41 PM by tshattuck »

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: wxmetar.php - icons no longer appearing
« Reply #1 on: July 21, 2015, 12:08:48 AM »
I'm sure Ken will come up with a simple fix.  My somewhat roundabout fix goes like this:
In 'wxmetar.php' I changed
Code: [Select]
$condIconDir = './ajax-images/';  // directory for ajax-images with trailing slash
$condIconType = '.gif'; // default type='.jpg' -- use '.gif' for animated icons from http://www.meteotreviglio.com/
to
Code: [Select]
$condIconDir = './forecast/images/';  // directory for ajax-images with trailing slash
$condIconType = '.png'; // default type='.jpg' -- use '.gif' for animated icons from http://www.meteotreviglio.com/
and added
Code: [Select]
$windDir  = './ajax-images/'; while leaving
Code: [Select]
$wrType   = '.gif';      // extension of the graphic filename
alone.

Then in 'include-metar-display.php' I changed
Code: [Select]
     <?php if(isset($mtr['WIND'])) { ?>

  <img src="<?php echo $condIconDir?>spacer.gif" width="1"

    height="<?php echo $wrHeight?>" alt=" " align="left"/>

  <?php $wr $condIconDir $wrName $dirlabel $wrType// normal wind rose

        $wr preg_replace('|varies|','calm',$wr);

        $wrtext langtransstr('Wind from') ." " langtransstr($dirlabel);

if (preg_match('!(calm|varies)!i',$mtr['WIND']) and

     ($wrCalm <> '') ) { // use calm instead

  $wr $condIconDir $wrCalm;

}
to
Code: [Select]
     <?php if(isset($mtr['WIND'])) { ?>

  <img src="<?php echo $condIconDir?>spacer.gif" width="1"

    height="<?php echo $wrHeight?>" alt=" " align="left"/>

  <?php $wr $windDir $wrName $dirlabel $wrType// normal wind rose

        $wr preg_replace('|varies|','calm',$wr);

        $wrtext langtransstr('Wind from') ." " langtransstr($dirlabel);

if (preg_match('!(calm|varies)!i',$mtr['WIND']) and

     ($wrCalm <> '') ) { // use calm instead

  $wr $windDir $wrCalm;

}
Finally in 'include-metar-display.php' I added the new global, '$windDir' to the 'newIcon($numb)' function, but I see now that neither it nor '$condIconDir' are used there, thus rendering that change superfluous.

These changes worked for me, so I stopped experimenting at that point.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline tshattuck

  • Forecaster
  • *****
  • Posts: 337
    • Your Local Weather - Clay, NY
Re: wxmetar.php - icons no longer appearing
« Reply #2 on: July 21, 2015, 01:17:29 PM »
Jerry:
I made the code changes as you suggested to the 2 php files and now the local metar page displays correctly.  :grin:

Thanks for bailing me out, it is much appreciated.

Regards,

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: wxmetar.php - icons no longer appearing
« Reply #3 on: July 21, 2015, 05:26:41 PM »
Thanks, Jerry!
John
W7JKG