added drag and photos
This commit is contained in:
@@ -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()
|
||||
]);
|
||||
}
|
||||
Reference in New Issue
Block a user