From 86b0fc7fdf5437cecc913800e8a027c8027d60ba Mon Sep 17 00:00:00 2001
From: John Hodge <tpg@ucc.asn.au>
Date: Mon, 3 May 2021 19:41:52 +0800
Subject: [PATCH] Support sub-minute images in archive.php

---
 archive.php | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/archive.php b/archive.php
index 84ac8fe..7030541 100644
--- a/archive.php
+++ b/archive.php
@@ -27,6 +27,7 @@
 	);
 
 	$camera = (isset($_GET['camera']) ? $_GET['camera'] : 'nocamera');
+	$sub_min = (isset($_GET['sub']) ? $_GET['sub'] : null);
 	$timestamp = (isset($_GET['timestamp']) ? DateTime::createFromFormat("Ymd-Hi", $_GET['timestamp']) : null);
 
 	// check camera is approved - mtearle
@@ -84,7 +85,12 @@
 			}
 		}
 
-		$file = $month_folder . $timestamp->format("d/H/") . $timestamp->format("i").".jpg";
+		// Support 6-second images (suffixed with -\d.jpg)
+		$file = $month_folder . $timestamp->format("d/H/") . $timestamp->format("i");
+		if( !($sub_min === null) ) {
+			$file .= "-".$sub_min;
+		}
+		$file .= ".jpg";
 		//header("X-WebcamFile: {$file}");
 	}
 	// If the image isn't available, emit "nocamera.jpg" with a 404 code
-- 
GitLab