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?
Thanks,
Pete
Welcome to the Cumulus Support forum.
Latest Cumulus MX V4 release 4.0.1 (build 4023) - 16 May 2024
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Legacy Cumulus 1 release 1.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
Latest Cumulus MX V4 release 4.0.1 (build 4023) - 16 May 2024
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Legacy Cumulus 1 release 1.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
- beteljuice
- Posts: 3292
- 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
Here's something the beteljuice put together many years ago ...
It uses three different images.
... and the php file (opt.php)
It uses three different images.
- Checking Camera Status (loading.jpg - 3 seconds)
Actual webcam image (cam_1.jpg)
Off-Line image (offline.jpg)
Code: Select all
<!-- web page code -->
<SCRIPT LANGUAGE="JavaScript">
<!--
function LoadImage1()
{
uniq1 = Math.random();
document.images.webcam1.src = "opt.php?uniq="+uniq1;
}
function StartDelay()
{
document.webcam1.onload="DoIt1()";
window.setTimeout("LoadImage1();", 3000); // status image delay
window.setInterval("LoadImage1();", 30000); // subsequent loop
}
function DoIt1()
{
window.setTimeout("LoadImage1();", 8000);
}
//-->
</script>
<!-- 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;">
Code: Select all
<?php
// Time to wait for showing the offline image in seconds
$offtime=300;
// We don't want cached results
clearstatcache();
// Get the time that the uploaded image is on the server
error_reporting(0);
$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){
readfile("cam_1.jpg");
} else {
// Else send the predefined off-line image
readfile("offline.jpg");
};
?>
You do not have the required permissions to view the files attached to this post.
......................Imagine, what you will KNOW tomorrow !
-
- Posts: 144
- 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
- Contact:
Re: Alert if webcam image out-of-date
Pete,
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
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 π rPi5
http://augusta-pines-weather.com / CumulusMX 4.0.0 build:4020
WeatherUnderground KTXSPRIN538
CumulusMX on Raspberry π rPi5
http://augusta-pines-weather.com / CumulusMX 4.0.0 build:4020
WeatherUnderground KTXSPRIN538