Parking Lot Camera Archive – Yesterday

[insert_php]
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Display the most recent images uploaded to a web site directory
// Code based on http://stackoverflow.com/questions/3847955/php-display-most-recent-images-from-directory
// Code by Ravi Gupta; started around June 2015
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
echo “\nClick on image to view full size.“;
// Time Zone http://php.net/manual/en/timezones.php
date_default_timezone_set(‘Canada/Eastern’);
$day = date(“d”, time() – 24 * 3600 );

// Website’s (image location’s) domain name; include sub domains if required
$domain = “lmac.ca”;

// Directory where images were archived
$image_locations = “lmac.ca/camera/FI9803P_00626E586324/snap/”;

// Image file name pattern.
$file_names = “*.{jpg,JPG}”;

// locations to search
$search = $image_locations.$file_names;

// Get image files from locations in $search
$images = glob($search, GLOB_BRACE);

//reverse sort, sort descending, newest images first based on file name
rsort($images);

// Image display loop
foreach($images as $image)
{
$image_time = filemtime($image);
$image_day = date (“d”, $image_time);
$image_size = round ( filesize($image) / 1000 , 0 );

if( ($image_day == $day) ) // Show image
{
//echo $image;
echo “
“.date (“F d, Y g:i a T”, $image_time).” $image_size kB”;
$image_url = “http://$domain/$image” ;
echo “
“;
}
} // Image display loop

[/insert_php]