Initial commit after re-install

This commit is contained in:
2026-02-25 19:12:32 +09:00
commit d2635610a4
539 changed files with 57575 additions and 0 deletions

35
api/list_images.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
// Returns a JSON list of images currently present in /img
require_once __DIR__ . '/../auth/auth.php';
dreamgirl_require_login_json();
header('Content-Type: application/json; charset=utf-8');
$imgDir = realpath(__DIR__ . '/../img');
if ($imgDir === false || !is_dir($imgDir)) {
http_response_code(500);
echo json_encode(['ok' => false, 'error' => 'img directory not found']);
exit;
}
$allowedExt = ['jpg','jpeg','png','gif','webp'];
$images = [];
$files = scandir($imgDir);
if ($files === false) $files = [];
foreach ($files as $f) {
if ($f === '.' || $f === '..') continue;
$path = $imgDir . DIRECTORY_SEPARATOR . $f;
if (!is_file($path)) continue;
$ext = strtolower(pathinfo($f, PATHINFO_EXTENSION));
if (!in_array($ext, $allowedExt, true)) continue;
$images[] = $f;
}
// stable order
natcasesort($images);
$images = array_values($images);
echo json_encode(['ok' => true, 'images' => $images], JSON_UNESCAPED_UNICODE);