load(); if (!isset($_ENV['DB_FILE_PATH'])) { die('DB_FILE_PATH is not set in the .env file'); } if (!file_exists('../' . $_ENV['DB_FILE_PATH'])) { die('Database file does not exist'); } // Create a new Database connection $dbFilePath = '../' . $_ENV['DB_FILE_PATH']; $database = new Database($dbFilePath); $image = new Image($database); // Get the list of albums $albumsQuery = "SELECT DISTINCT album FROM images"; $albumsResult = $database->getConnection()->query($albumsQuery); $albums = []; while ($row = $albumsResult->fetchArray(SQLITE3_ASSOC)) { $albums[] = $row['album']; } // Fetch the first image from each album $albumPreviews = []; foreach ($albums as $album) { $albumPreviews[$album] = $image->getImages($album, 1, 0)[0] ?? null; } ?> Photo Gallery - Select Album

Select an Album

$image): ?>