12-08-2022
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
<?php
|
||||
|
||||
function preprint($s, $return=false) {
|
||||
$x = "<pre>";
|
||||
$x .= print_r($s, 1);
|
||||
$x .= "</pre>";
|
||||
if ($return) return $x;
|
||||
else print $x;
|
||||
}
|
||||
|
||||
/* Fonction month(): convertit le mois (nb) en mois (texte) francais
|
||||
|
||||
photo-du-mois.php
|
||||
@@ -77,22 +85,62 @@ function get_gps($exif) {
|
||||
$GPSLongitude = isset($exif['GPS']['GPSLongitude']) ? $exif['GPS']['GPSLongitude'] : '';
|
||||
$GPSAltitude = isset($exif['GPS']['GPSAltitude']) ? $exif['GPS']['GPSAltitude'] : '';
|
||||
|
||||
preprint($GPSLatitude);
|
||||
preprint($GPSLongitude);
|
||||
preprint($GPSAltitude);
|
||||
|
||||
$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;
|
||||
|
||||
|
||||
/*
|
||||
echo "latitude <br />";
|
||||
echo $lat_degrees . "<br />";
|
||||
echo $lat_minutes . "<br />";
|
||||
echo $lat_seconds . "<br />";
|
||||
*/
|
||||
|
||||
$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;
|
||||
|
||||
/*
|
||||
echo "longitude <br />";
|
||||
echo $lon_degrees . "<br />";
|
||||
echo $lon_minutes . "<br />";
|
||||
echo $lon_seconds . "<br />";
|
||||
*/
|
||||
|
||||
$lat_direction = ($GPSLatitudeRef == 'W' or $GPSLatitudeRef == 'S') ? -1 : 1;
|
||||
$lon_direction = ($GPSLongitudeRef == 'W' or $GPSLongitudeRef == 'S') ? -1 : 1;
|
||||
|
||||
|
||||
/*
|
||||
echo $lat_direction . "<br />";
|
||||
echo $lon_direction . "<br />";
|
||||
*/
|
||||
|
||||
$latitude = $lat_direction * ($lat_degrees + ($lat_minutes / 60) + ($lat_seconds / (60*60)));
|
||||
$longitude = $lon_direction * ($lon_degrees + ($lon_minutes / 60) + ($lon_seconds / (60*60)));
|
||||
|
||||
#echo "lat type: " . gettype($latitude);
|
||||
$latitude = number_format($latitude, 10, '.', '');
|
||||
#echo "long type: " . gettype($longitude);
|
||||
$longitude = number_format($longitude, 10, '.', '');
|
||||
|
||||
#echo "latitude: " . $latitude . "<br />";
|
||||
#echo "longitude: " . $longitude . "<br />";
|
||||
|
||||
$alt = explode('/', $GPSAltitude);
|
||||
$altitude = (isset($alt[1])) ? ($alt[0] / $alt[1]) : $alt[0];
|
||||
if($GPSAltitude != ""){
|
||||
$alt = explode('/', $GPSAltitude);
|
||||
$altitude = (isset($alt[1])) ? ($alt[0] / $alt[1]) : $alt[0];
|
||||
}
|
||||
else $altitude = 0;
|
||||
|
||||
#echo "alt type: " . gettype($altitude);
|
||||
$altitude = number_format($altitude, 2, '.', '');
|
||||
|
||||
#echo "altitude: " . $altitude . "<br />";
|
||||
|
||||
}
|
||||
else {
|
||||
$latitude = '';
|
||||
|
||||
Reference in New Issue
Block a user