22-03-2022
This commit is contained in:
@@ -9,7 +9,7 @@ function month($w) {
|
||||
//setlocale(LC_TIME, 'fr_FR');
|
||||
$m = date('m', strtotime($w)); // month
|
||||
$y = date('Y', strtotime($w)); // year
|
||||
//echo $m . "-" . $y;
|
||||
//echo $w . "- month: " . $m . "- year: " . $y;
|
||||
|
||||
// or any other locales like pl_PL, cs_CZ, fr_FR, zh, zh_Hans, ...
|
||||
$locale = 'fr_FR';
|
||||
@@ -26,6 +26,10 @@ function month($w) {
|
||||
DateTime::createFromFormat('n', (string)$month_number)
|
||||
);
|
||||
}
|
||||
|
||||
array_unshift($months_locale,"");
|
||||
unset($months_locale[0]);
|
||||
//_pr($months_locale);
|
||||
$my = ucfirst($months_locale[(int)$m]) . " " . $y;
|
||||
//echo $my;
|
||||
return $my;
|
||||
@@ -38,16 +42,40 @@ function month($w) {
|
||||
*/
|
||||
|
||||
function gps2Num($coordPart){
|
||||
/*
|
||||
Array
|
||||
(
|
||||
[0] => 46/1
|
||||
[1] => 408587/10000
|
||||
[2] => 0/0
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 5/1
|
||||
[1] => 562596/10000
|
||||
[2] => 0/0
|
||||
)
|
||||
*/
|
||||
|
||||
$parts = explode('/', $coordPart);
|
||||
//echo $parts[0].'-'.$parts[1].'<br>';
|
||||
if(count($parts) <= 0)
|
||||
return 0;
|
||||
if(count($parts) == 1)
|
||||
return $parts[0];
|
||||
return floatval($parts[0]) / floatval($parts[1]);
|
||||
if($parts[1] != 0)
|
||||
return floatval($parts[0]) / floatval($parts[1]);
|
||||
else return 0;
|
||||
}
|
||||
|
||||
function get_gps($exif) {
|
||||
|
||||
if($exif && isset($exif['GPS'])){
|
||||
/*
|
||||
echo $exif['FILE']['FileName'];
|
||||
_pr($exif['GPS']['GPSLatitude']);
|
||||
_pr($exif['GPS']['GPSLongitude']);
|
||||
*/
|
||||
$GPSLatitudeRef = isset($exif['GPS']['GPSLatitudeRef']) ? $exif['GPS']['GPSLatitudeRef'] : '';
|
||||
$GPSLatitude = isset($exif['GPS']['GPSLatitude']) ? $exif['GPS']['GPSLatitude'] : '';
|
||||
$GPSLongitudeRef = isset($exif['GPS']['GPSLongitudeRef']) ? $exif['GPS']['GPSLongitudeRef'] : '';
|
||||
@@ -57,18 +85,18 @@ function get_gps($exif) {
|
||||
$lat_degrees = count($GPSLatitude) > 0 ? gps2Num($GPSLatitude[0]) : 0;
|
||||
$lat_minutes = count($GPSLatitude) > 1 ? gps2Num($GPSLatitude[1]) : 0;
|
||||
$lat_seconds = count($GPSLatitude) > 2 ? gps2Num($GPSLatitude[2]) : 0;
|
||||
|
||||
$lon_degrees = count($GPSLongitude) > 0 ? gps2Num($GPSLongitude[0]) : 0;
|
||||
|
||||
$lon_degrees = count($GPSLongitude) > 0 ? gps2Num($GPSLongitude[0]) : 0;
|
||||
$lon_minutes = count($GPSLongitude) > 1 ? gps2Num($GPSLongitude[1]) : 0;
|
||||
$lon_seconds = count($GPSLongitude) > 2 ? gps2Num($GPSLongitude[2]) : 0;
|
||||
|
||||
|
||||
$lat_direction = ($GPSLatitudeRef == 'W' or $GPSLatitudeRef == 'S') ? -1 : 1;
|
||||
$lon_direction = ($GPSLongitudeRef == 'W' or $GPSLongitudeRef == 'S') ? -1 : 1;
|
||||
|
||||
$latitude = $lat_direction * ($lat_degrees + ($lat_minutes / 60) + ($lat_seconds / (60*60)));
|
||||
$longitude = $lon_direction * ($lon_degrees + ($lon_minutes / 60) + ($lon_seconds / (60*60)));
|
||||
|
||||
$alt = explode('/', $exif['GPS']["GPSAltitude"]);
|
||||
$alt = explode('/', $GPSAltitude);
|
||||
$altitude = (isset($alt[1])) ? ($alt[0] / $alt[1]) : $alt[0];
|
||||
}
|
||||
else {
|
||||
@@ -77,11 +105,13 @@ function get_gps($exif) {
|
||||
$altitude = '';
|
||||
}
|
||||
|
||||
//echo $latitude . " - " . $longitude . " - " . $altitude;
|
||||
|
||||
return array('latitude'=>$latitude, 'longitude'=>$longitude, 'altitude'=>$altitude);
|
||||
}
|
||||
|
||||
|
||||
/* Fonction create_thumb(): Création des vigntettes
|
||||
/* Fonction create_thumb(): Création des vignettes
|
||||
|
||||
insert_bdd.php
|
||||
*/
|
||||
@@ -188,4 +218,20 @@ function geo_single_fracs2dec($fracs) {
|
||||
geo_frac2dec($fracs[2]) / 3600;
|
||||
}
|
||||
|
||||
/**/
|
||||
function host() {
|
||||
$pv_sslport=443;
|
||||
//$pv_serverport=80;
|
||||
//$pv_servername="sur-le-sentier.fr";
|
||||
|
||||
$pv_URIprotocol = isset($_SERVER["HTTPS"]) ? (($_SERVER["HTTPS"]==="on" || $_SERVER["HTTPS"]===1 || $_SERVER["SERVER_PORT"]===$pv_sslport) ? "https://" : "http://") : (($_SERVER["SERVER_PORT"]===$pv_sslport) ? "https://" : "http://");
|
||||
if ($_SERVER['HTTP_HOST'] == "sur-le-sentier.fr") {
|
||||
$host = $pv_URIprotocol . $_SERVER['HTTP_HOST'] . "/";
|
||||
}
|
||||
elseif ($_SERVER['HTTP_HOST'] == "airbook.local") {
|
||||
$host = $pv_URIprotocol . $_SERVER['HTTP_HOST'] . "/sls/";
|
||||
}
|
||||
return $host;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user