$relative_project_stop || $current_time < $relative_project_start)) { if ($current_time > $relative_project_stop) { $relative_project_start = strtotime("$current_date, {$project_start_hour}:{$project_start_min}$project_start_ampm"); $relative_project_stop = strtotime("$current_date, {$project_stop_hour}:{$project_stop_min}$project_stop_ampm"); $start_time_unix = $relative_project_stop - 7200; $stop_time_unix = $relative_project_stop; } else { $relative_project_start = strtotime("$yesterdays_date, {$project_start_hour}:{$project_start_min}$project_start_ampm"); $relative_project_stop = strtotime("$yesterdays_date, {$project_stop_hour}:{$project_stop_min}$project_stop_ampm"); $start_time_unix = $relative_project_stop - 3600; $stop_time_unix = $relative_project_stop; } } // If the start time is before the actual start time of the project for the current day if ($start_time_unix < $relative_project_start) { $start_time_unix = $relative_project_start; } } elseif ($today == 'on') { $loop_speed = '120'; $today_date = date("Ymd"); $start_time_unix = strtotime("$today_date, {$project_start_hour}:{$project_start_min}$project_start_ampm"); $stop_time_unix = strtotime("$today_date, {$project_stop_hour}:{$project_stop_min}$project_stop_ampm"); } elseif ($yesterday == 'on') { $loop_speed = '120'; $yesterday_date = date("Ymd", time()-86400); $start_time_unix = strtotime("$yesterday_date, {$project_start_hour}:{$project_start_min}$project_start_ampm"); $stop_time_unix = strtotime("$yesterday_date, {$project_stop_hour}:{$project_stop_min}$project_stop_ampm"); } elseif ($project == 'on') { $loop_speed = '120'; $today_date = date("Ymd"); $start_time_unix = strtotime("$project_start_date, {$project_start_hour}:{$project_start_min}$project_start_ampm"); $stop_time_unix = strtotime("$today_date, {$project_stop_hour}:{$project_stop_min}$project_stop_ampm"); } $animation = 'yes'; // We still need these variables to have the time options selected $start_time_unix = round_time($start_time_unix, 'down', '10'); $start_year = date("Y", $start_time_unix); $start_month = strtolower(date("M", $start_time_unix)); $start_day = date("d", $start_time_unix); $start_time = date("Hi", $start_time_unix); $stop_time_unix = round_time($stop_time_unix, 'up', '10'); $stop_year = date("Y", $stop_time_unix); $stop_month = strtolower(date("M", $stop_time_unix)); $stop_day = date("d", $stop_time_unix); $stop_time = date("Hi", $stop_time_unix); } elseif ($_GET['s1y'] && $_GET['s2y']) { /////////////////////////////// // CUSTOM TIME PERIOD /// /////////////////////////////// // Assorted Variables $loop_speed = '120'; $animation = 'yes'; //If the start and stop details exist from the query string, use them if ($start_year && $stop_year) { $start_time_unix = strtotime("$start_month $start_day,$start_year, $start_time"); $stop_time_unix = strtotime("$stop_month $stop_day, $stop_year, $stop_time"); } else { // If no start and stop details exist in the query string, use a default as below $current_time = time(); $current_date = date("Ymd"); $relative_project_start = strtotime("$current_date, {$project_start_hour}:{$project_start_min}$project_start_ampm"); $relative_project_stop = strtotime("$current_date, {$project_stop_hour}:{$project_stop_min}$project_stop_ampm"); // If outside of the cameras operating hours, display the last hour of images if (($current_time > $relative_project_stop || $current_time < $relative_project_start)) { if ($current_time > $relative_project_stop) { $start_time_unix = $relative_project_stop - 3600; $stop_time_unix = $relative_project_stop; } else { $start_time_unix = $relative_project_stop - 90000; $stop_time_unix = $relative_project_stop - 86400; } } // Otherwise, default to the previous hours worth of images else { $start_time_unix = time()-3600; $stop_time_unix = time(); } } // We still need these variables to have the time options selected $start_time_unix = round_time($start_time_unix, 'down', '10'); $start_year = date("Y", $start_time_unix); $start_month = strtolower(date("M", $start_time_unix)); $start_day = date("d", $start_time_unix); $start_time = date("Hi", $start_time_unix); $stop_time_unix = round_time($stop_time_unix, 'up', '10'); $stop_year = date("Y", $stop_time_unix); $stop_month = strtolower(date("M", $stop_time_unix)); $stop_day = date("d", $stop_time_unix); $stop_time = date("Hi", $stop_time_unix); } else { // This is to show a default time selection for the custom time period $start_time_unix = round_time($start_time_unix, 'down', '10'); $start_time_unix = time()-3600; $start_year = date("Y", $start_time_unix); $start_month = strtolower(date("M", $start_time_unix)); $start_day = date("d", $start_time_unix); $start_time = date("Hi", $start_time_unix); $stop_time_unix = round_time($stop_time_unix, 'up', '10'); $stop_time_unix = time(); $stop_year = date("Y", $stop_time_unix); $stop_month = strtolower(date("M", $stop_time_unix)); $stop_day = date("d", $stop_time_unix); $stop_time = date("Hi", $stop_time_unix); } // Creat the archived image list if ($start_time_unix > $stop_time_unix) { $error = 'yes'; } elseif ($project == 'on') { $image_list = get_project_images($cam); } else { $image_list = get_images($cam, $date, $start_time_unix, $stop_time_unix); } $total_images = sizeof($image_list); $animation_start_screen = date("g:ia, F j", $start_time_unix); $animation_stop_screen = date("g:ia, F j", $stop_time_unix); ?>