Another Picture of the Day script
Posted in Other Projects, Tutorials May 27th, 2020 by dotcomboom
<?php
$today = (int)date('Yz');
    
srand($today);
    
$files = glob('*/*/thumbs/*.jpg');  // your folder structure goes here, my new one is like 2018/september/thumbs/*.jpg
$file = array_rand($files);

// open the file in a binary mode
$name = $files[$file];
$fp = fopen($name, 'rb');

// send the right headers
header("Content-Type: image/jpeg");
header("Content-Length: " . filesize($name));

// dump the picture and stop the script
fpassthru($fp);
exit;
?>

Embedded like this:

<img src="oftheday.php" alt="[img]">

(If you need to display EXIF information or link to the original image, see this script instead.)