intial commit

This commit is contained in:
Brandon4466
2025-07-26 17:08:09 -07:00
commit 3ca3676b36
4 changed files with 156 additions and 0 deletions

24
list-images.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
$dir = __DIR__ . '/images/';
$thumbDir = $dir . 'thumbnails/';
$extensions = ['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp'];
$images = [];
if (is_dir($dir)) {
foreach (scandir($dir) as $file) {
$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
if (in_array($ext, $extensions)) {
$thumbPath = 'images/thumbnails/' . $file;
$fullPath = 'images/' . $file;
// Check if thumbnail exists
if (file_exists($thumbDir . $file)) {
$images[] = ['thumb' => $thumbPath, 'full' => $fullPath];
} else {
$images[] = ['thumb' => $fullPath, 'full' => $fullPath];
}
}
}
}
header('Content-Type: application/json');
echo json_encode($images);
?>