getTimestamp()); //echo $date . EOL; if ( ! empty($datas["DateTime"]) ) { $datetime_local = date_create_from_format("Y:m:d H:i:s", $datas["DateTime"]); }elseif ( ! empty($datas["DateTimeOriginal"]) ) { $datetime_local = date_create_from_format("Y:m:d H:i:s", $datas["DateTimeOriginal"]); }else { $flag = true; } if ( $flag = false ) { $list[$x]["datetimelocal"] = date( "c", $datetime_local->getTimestamp()); $dh = $datetime->diff( $datetime_local ); $decalagehoraire = $dh->h; if ( $dh->i >55) { $decalagehoraire += 1; } if ( $decalagehoraire >=0 ) { $decalagehoraire = "+" . str_pad(abs($decalagehoraire), 4, "0", STR_PAD_BOTH ); }else { $decalagehoraire = "-" . str_pad(abs($decalagehoraire), 4, "0", STR_PAD_BOTH ); } $list[$x]["fuseauhoraire"] = $decalagehoraire; }else { $decalagehoraire = ""; } $datetime->setTimeZone(new DateTimeZone('Europe/Paris')); echo $path . EOL; echo strftime( "le %A %c heure de Paris", $datetime->getTimestamp() ) . EOL; echo strftime( "le %A %c heure locale", $datetime_local->getTimestamp() ) . EOL; echo "Fuseau horaire : " . $decalagehoraire .EOL; echo "Latitude : $latitude $dlatitude\nLongitude : $longitude $dlongitude\nAltitude : $altitude\n"; //print_r($datas); } } } function convert2decimal( $d, $m, $s) { return transform( $d ) + transform($m)/60 + transform($s)/3600; } function transform($a) { $b = explode( "/", $a); $r = floatval($b[0]) / floatval($b[1]); return $r; } function gpstime( $a ) { $h = explode("/", $a[0]); $m = explode("/", $a[1]); $s = explode("/", $a[2]); return str_pad( $h[0], 2 ,"0", STR_PAD_LEFT ) . ":" . str_pad( $m[0], 2 ,"0", STR_PAD_LEFT ) . ":" . str_pad( $s[0], 2 ,"0", STR_PAD_LEFT ); } function exportKML( $list ) { $enteteKML = '' . EOL; print_r($list); if ( ! $fh = fopen("export_jpg2gpx_" . date("YmdHis") . ".kml", "w") ) { $erreur = error_get_last(); echo "Erreur fopen ligne " . __LINE__ . " : " . $erreur["message"] . EOL; exit (1); } fwrite( $fh, $enteteKML ); foreach ( $list as $ligne ) { $text = "" . EOL . "" . basename($ligne["name"]) . "" . EOL . "" . $ligne["name"] . EOL . "Altitude : " . $ligne["altitude"] . EOL . "Heure UTC : " . $ligne["datetimeUTC"] . EOL . "Heure locale :" . $ligne["datetimelocal"] . EOL . "Fuseau horaire : " . $ligne["fuseauhoraire"] . EOL . "Généré automatiquement" .EOL; $text .= " " . EOL . " " . $ligne["longitude"] . "," . $ligne["latitude"] . "" . EOL . " " . EOL . " " . EOL; fwrite( $fh, $text ); } fwrite( $fh, "" ); } function exportGPX( $list ) { $enteteXML = 'export_jpg2gpx_' . date("YmdHis") . '' . EOL; if ( ! $fh = fopen("export_jpg2gpx_" . date("YmdHis") . ".gpx", "w") ) { $erreur = error_get_last(); echo "Erreur fopen ligne " . __LINE__ . " : " . $erreur["message"] . EOL; exit (1); } fwrite( $fh, $enteteXML ); foreach ( $list as $ligne ) { $text = ''; $text .= "" . $ligne["altitude"] . ""; $text .= "" . EOL; $text .= "" . basename($ligne["name"]) . "" . EOL; $text .= "Généré automatiquement" . EOL; $text .= "" . $ligne["name"] . EOL; if ( ! empty($ligne["datetimelocal"]) ) { $text .= " Heure locale :" . $ligne["datetimelocal"]; } $text .= "" . EOL; $text .= "" .EOL; fwrite( $fh, $text ); } fwrite( $fh, "" ); } function remplacevirgule ( $f ) { }