Nouveautés:
- AJAX pour récupérer les données depuis la base
- Leaflet pour l’API
- Openstreetmap pour les cartes
This commit is contained in:
2025-02-18 15:38:23 +01:00
parent cab19ef683
commit e627a8e3ff
26 changed files with 1409 additions and 157 deletions

62
maps/api/liste.php Normal file
View File

@@ -0,0 +1,62 @@
<?php
// Headers
/**/
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json; charset=UTF-8');
header('Access-Control-Allow-Methods: GET');
header('Access-Control-Max-Age: 3600');
header('Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With');
if($_SERVER['REQUEST_METHOD'] !== 'GET'){
http_response_code(405);
echo json_encode(['error' => 'Method unauthorized']);
exit;
}
include '../../i18n_setup.php';
$base = '../../db_photo.sqlite3';
$chemin = 'photos/img/';
$chemin_thumb = str_replace("img", "thumb", $chemin);
include '../../functions.php';
try {
$conn4 = new PDO("sqlite:$base");
$query4 = "SELECT filename, filesize, dateoriginal, lens, speed, correctexpo, iso, usercomment, comment, model, metering, flash, focal, program, wb, mode, width, height, html, aperture, software, lat, long, alt, keywords, title, creator, city, department, code, country, copyright, legende FROM photos WHERE lat != '' ORDER BY dateoriginal DESC";
#$query4 = "SELECT filename, filesize, dateoriginal, lens, speed, correctexpo, iso, model, metering, flash, focal, program, wb, mode, width, height, aperture, software, lat, long, alt, keywords, title, creator, city, department, code, country, copyright, legende FROM photos WHERE lat != '' ORDER BY dateoriginal DESC";
$stmt = $conn4->prepare($query4);
$stmt->execute();
/*
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
//$rowcount = count($result);
*/
$for_map=array();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$f=array();
$f = data_for_lightbox($row);
//debug_to_console($f['description']);
$for_map[]=$f;
}
$conn4 = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
//_pr($result);
//_pr($for_map);
/**/
//_pr($for_map['description']);
//debug_to_console($for_map['description']);
//echo json_encode($result);
echo json_encode($for_map);