added drag and photos

This commit is contained in:
2025-11-22 13:35:12 +01:00
parent eeb1d0d5de
commit 8edccbdfef
21 changed files with 2006 additions and 121 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
header('Content-Type: application/json');
require_once __DIR__ . '/class/db-functions.php';
try {
$db = DBHandlerSelect::getInstance();
$pdo = $db->getConnection();
$production_id = isset($_GET['production_id']) ? (int)$_GET['production_id'] : 0;
$photo_type = $_GET['photo_type'] ?? '';
if ($production_id <= 0 || $photo_type === '') {
throw new Exception("Parametri non validi");
}
$stmt = $pdo->prepare("
SELECT id, filename, photo_type, created_at, elaborato
FROM production_photos
WHERE production_id = :prod AND photo_type = :ptype
ORDER BY created_at DESC, id DESC
");
$stmt->execute([
':prod' => $production_id,
':ptype' => $photo_type
]);
$photos = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode([
'success' => true,
'photos' => $photos
]);
} catch (Exception $e) {
echo json_encode([
'success' => false,
'message' => $e->getMessage()
]);
}