diff --git a/archive.php b/archive.php index bbdd5e101934167108c04536e38b4012aa876c12..e646d09d21d27a80749848f0e3fb90dbe28e1bff 100644 --- a/archive.php +++ b/archive.php @@ -53,6 +53,36 @@ passthru($cmd); exit(); } + + $zipfile_day = $month_folder . $timestamp->format("Ymd").".zip"; + if( is_readable($zipfile_day) ) { + $zip = new ZipArchive; + $zip->open($zipfile_day); + $iname = $timestamp->format("d/H/i").".jpg"; + $c = $zip->getFromName($iname); + if($c !== false) { + header("Content-Type: image/jpeg"); + header("Content-Length: ".strlen($c)); + header("Last-Modified: ".gmdate("D, d M Y H:i:s", filectime($zipfile_day))." GMT"); + echo $c; + exit(); + } + } + + $zipfile_month = "archive/" . $camera . "/" . $timestamp->format("Ym").".zip"; + if( is_readable($zipfile_month) ) { + $zip = new ZipArchive; + $zip->open($zipfile_month); + $c = $zip->getFromName($timestamp->format("Ym/d/H/i").".jpg"); + if($c !== false) { + header("Content-Type: image/jpeg"); + header("Content-Length: ".strlen($c)); + header("Last-Modified: ".gmdate("D, d M Y H:i:s", filectime($zipfile_month))." GMT"); + echo $c; + exit(); + } + } + $file = $month_folder . $timestamp->format("d/H/") . $timestamp->format("i").".jpg"; //header("X-WebcamFile: {$file}"); }