Welcome to the Cumulus Support forum.

Latest Cumulus MX release 3.11.4 (build 3133) - 25 May 2021 (please see announcement regarding releases since 3.5.0)
Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Alert if webcam image out-of-date

Hardware/software/hints and tips/discussion/webcam links etc
Post Reply
Posts: 1
Joined: Sat 03 Sep 2016 5:59 pm
Weather Station: Fine Offset
Operating System: Windows 10

Alert if webcam image out-of-date

Post by sarfend »

Hi all,

I wonder if anyone has any suggestions on this one.

On my weather site, I have a display of my station data courtesy of Cumulus and the Saratoga PHP scripts. I also used Cumulus to upload a webcam image every 10 minutes.

It's not uncommon for something to go wrong - either the station stops collecting data, the PC locks.reboots or there's an error, which means my online data is out-of-date. I use a number of solutions to keep everything working (Cumulus Toolbox plus a PHP script that checks all's up to date. Everything works well, and I get email alerts if the weather data is out-of-date. The only thing I can't fix, is the webcam.

On occasion, the webcam capture software stops. Cumulus dutifully uploads whatever image it can find, so the website reports there's a recently-uploaded image, and the site displays an image.

Ideally, what I need is for Cumulus to spot that the image has a filestamp of >15 minutes, generate a tag, and I can detect that tag on the site.

My status page is here: http://www.sarfend.co.uk/weather/status.php - and using a site monitor, I can get an email alert if any errors appear on this page - what I can't do, is identify the age of the local jpg prior to Cumulus uploading it.

Anyone think of any clever ways around this?



User avatar
Posts: 3210
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Alert if webcam image out-of-date

Post by beteljuice »

Here's something the beteljuice put together many years ago ...

It uses three different images.
  • Checking Camera Status (loading.jpg - 3 seconds)
    Actual webcam image (cam_1.jpg)
    Off-Line image (offline.jpg)
It uses both Javascript in the web page and a php script to do the timestamp check.

Code: Select all

<!-- web page code -->

function LoadImage1()

        uniq1 = Math.random();
	document.images.webcam1.src = "opt.php?uniq="+uniq1;


function StartDelay()
        window.setTimeout("LoadImage1();", 3000); // status image delay
        window.setInterval("LoadImage1();", 30000); // subsequent loop

function DoIt1()
        window.setTimeout("LoadImage1();", 8000);


<!-- then where you put the image -->

<img src="loading.jpg" id="webcam1" name="webcam1" onload="StartDelay()" width=320 height=240 border=1 style="border-color:#a4a4ff; border-style:solid;">

... and the php file (opt.php)

Code: Select all


// Time to wait for showing the offline image in seconds

// We don't want cached results
// Get the time that the uploaded image is on the server
$calctime=date("U") - filemtime("cam_1.jpg");

// If the uploaded image exists and its new enough
if (file_exists("cam_1.jpg") and $calctime<=$offtime){
} else {
// Else send the predefined off-line image
You do not have the required permissions to view the files attached to this post.
......................Imagine, what you will KNOW tomorrow !

Posts: 77
Joined: Sun 13 Feb 2011 7:12 pm
Weather Station: Davis Vantage Pro 2
Operating System: RaspBerry Pi Win 10 OSx
Location: Spring, Texas USA

Re: Alert if webcam image out-of-date

Post by f4phlyer »

Not sure if Beteljuice answered your question but it seems you have more than basic skills. I would think it would be possible to create a script to check the image "metadata" for "create time/date" and compare it to current date, then handle the email the same. There are apps/programs to strip the metadata and put it in a file. Hope this helps
retreat at augusta pines weather
CumulusMX on Raspberry π 3
http://augusta-pines-weather.com / CumulusMX 3.11.4 b:3133
WeatherUnderground KTXSPRIN538

Post Reply