Author Topic: Saratoga index.php auto refresh  (Read 433 times)

0 Members and 1 Guest are viewing this topic.

Offline mldenison

  • Contributor
  • ***
  • Posts: 111
    • York, PA Weather
Saratoga index.php auto refresh
« on: June 28, 2020, 02:46:10 PM »
Not sure if this is possible.

I just added my web camera backyard to my Saratoga template via the index.php: https://www.m82a1.us/index.php

It displays a jpg which is uploaded to my webpage every 30 seconds.

The code is pretty simple.

Code: [Select]
<center>
<img src="https://www.m82a1.us/weather/BackCam.jpg" width="620" alt="webcam"></img>
</center>

Is there a way to refresh the image every 30 - 60 seconds?

Thanks
Windows 7 x64
Weather PC: Intel NUC
Davis Vantage Pro 2
Weather Underground: KPAYORK30
York, PA Weather (Saratoga)
York, PA Weather (Leuven)
York, PA PWS Station

Offline AWL

  • Forecaster
  • *****
  • Posts: 727
    • Ardmore Weather Live
Re: Saratoga index.php auto refresh
« Reply #1 on: June 28, 2020, 04:02:31 PM »
Might try to drop this in where your image is located. Works for me.  Should update every 3 minutes or change the "T" to your needs. Other images can be added, like image2, image3 with additional "id"s.


Good luck, Doug

Code: [Select]
        <center>
         <img src="https://www.m82a1.us/weather/BackCam.jpg" width="620" alt="webcam" id="refresh"></img>
        </center>
   <script language="JavaScript" type="text/javascript">
           //<![CDATA[
               var t = 180 // Interval in Seconds
               image1 ="/weather/BackCam.jpg" //URLs of the Images
               function Start() {
          tmp = new Date();
          tmp = "?"+tmp.getTime()
          document.images["refresh" ].src = image1+tmp
          setTimeout("Start()", t*1000)
                        }
              Start();
          //]]>
         </script>
« Last Edit: June 28, 2020, 04:20:53 PM by AWL »

Offline mldenison

  • Contributor
  • ***
  • Posts: 111
    • York, PA Weather
Re: Saratoga index.php auto refresh
« Reply #2 on: June 28, 2020, 05:30:04 PM »
Working great (once I put id="refresh" in the code).  I appreciate it
Windows 7 x64
Weather PC: Intel NUC
Davis Vantage Pro 2
Weather Underground: KPAYORK30
York, PA Weather (Saratoga)
York, PA Weather (Leuven)
York, PA PWS Station

Offline AWL

  • Forecaster
  • *****
  • Posts: 727
    • Ardmore Weather Live
Re: Saratoga index.php auto refresh
« Reply #3 on: June 28, 2020, 05:32:14 PM »
Glad you got it going.


Doug