maps.php
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:
62
maps/api/liste.php
Normal file
62
maps/api/liste.php
Normal 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);
|
||||
Reference in New Issue
Block a user