ec-lightning.php script to display Environment Canada Lightning Danger map(s)

I’ve just finished a new script (ec-lightning.php V1.00 - 15-Oct-2016) to fetch, resize/cache, and display the Lightning Danger Map from the Environment Canada website. The script works similarly to the ec-radar.php script in that it caches the pages/etc in the ./radar/ directory by default.

Here’s a live sample (updated whenever someone visits the script page) of the output

Standalone users: please use the script page for instructions and download.
Saratoga Base-Canada template users: please use the Update tool page with a query for Base-Canada, Plugin-*, 15-Oct-2016
to get a complete set of the updates. Note that a Settings.php and flyout-menu.xml are included. You don’t have to replace them if you don’t want to-- they are updated with entries to support the new ec-lightning.php and wxeclightning.php pages on the site. See the ec-lightning-README.txt for additional information.

Best regards,
Ken

Works like a charm, Ken! Thank you so much!

Dan

Just curious… :roll:

Am I the only one seeing the following message when trying to use the ‘ec-lightning’ script:

"Notice: Undefined variable: newestImageIdx in ec-lightning.php on line 792..."

It appears the variable ‘$newestImageIdx’ is not passed to (missing from) the following function (at line 765, I think):


   function ECL_gen_animation( $numImages, $lightningID, $lightningDir, $aniSec ){...}

Should the variable ‘$newestImageIdx’ not be part of (added to) the global variables inside that function (lines 767/768, I think) to remove the message, such as:


   global $new_width, $new_height, $siteTitle, $imgListText, $ECLPlay, $ECLPrev, $ECLNext, $ECLNoJS,
       $siteHeading, $noJSMsg, $ECLNO, $TZ, $TZOffsecSecs, $autoPlay, $ECLlegend, $siteDescription, $newestImageIdx;

You are correct… that variable should be included in the global statement inside the function.

I just tried the script with error_reporting(E_ALL) turned on, and surprisingly, there wasn’t a Notice erratum in the output or logs. :roll: #-o

I do development with a local PHP that has all the error messaging turned on, so this is surprising. Thanks for spotting the issue.

I’ll be doing an update with that fix (and some code improvements) later.

Best regards,
Ken