≡ Menu

Webcams

read())) {
$filepath = “{$path}/{$entry}”;
// could do also other checks than just checking whether the entry is a file
if (is_file($filepath) && filectime($filepath) > $latest_ctime) {
$latest_ctime = filectime($filepath);
$latest_filename = $entry;
}
}
// now $latest_filename contains the filename of the file that changed last

$file = “images/Midway/FI9805P_00626E53699B/snap/” . “$latest_filename”;
$weekday = date(“l”);
$newfile = “images/cam2/midway” . “latest” . “.jpg”;
if(!@copy($file, $newfile)) {
$errors= error_get_last();
echo “COPY ERROR: “.$errors[‘type’];
echo “
\n”.$errors[‘message’];
error_log(“failed to copy $file…\n”, 3, “wp-content/error_log”);
echo “failed to copy $file…\n”;
} else {error_log(“Successfully copied $file\n”, 3, “wp-content/error_log”);
}
?>