[9377] | 1 | <?php |
---|
| 2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 3 | global $lang; |
---|
| 4 | load_language('lang', dirname(__FILE__).'/../'); |
---|
| 5 | $admin_url = PHPWG_ROOT_PATH.'admin.php'; |
---|
| 6 | if ( !isset($_GET['cat']) ) $_GET['cat'] = 'caddie'; |
---|
| 7 | $_GET['mode'] = 'map'; |
---|
| 8 | if (PHPWG_VERSION < 2.2 ) |
---|
| 9 | include (PHPWG_ROOT_PATH.'admin/element_set.php'); |
---|
| 10 | else |
---|
| 11 | include (dirname(__FILE__).'\element_set.php'); |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | /***********************************************************************************/ |
---|
[9412] | 19 | if (!defined('TOOL_KIT_PATH')) define( 'TOOL_KIT_PATH', EDIT_CL_PATH."admin/"); |
---|
[9377] | 20 | if (!defined('INCLUDE_PATH')) define( 'INCLUDE_PATH', TOOL_KIT_PATH.'include/' ); |
---|
| 21 | $Toolkit_Dir =INCLUDE_PATH ; |
---|
| 22 | |
---|
[9412] | 23 | include_once $Toolkit_Dir . 'fonctions.php'; |
---|
[9377] | 24 | /***********************************************************************************/ |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | $template->concat('TABSHEET_TITLE', ' '.l10n_dec('%d image', '%d images', count($page['cat_elements_id'])).' - '.$page['title']); |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | if ( isset($_POST['submit']) ) |
---|
| 31 | { |
---|
| 32 | $collection = array(); |
---|
| 33 | if( !isset ($_POST['target'])) |
---|
| 34 | { |
---|
| 35 | $_POST['submit'] == l10n('Submit') ; |
---|
| 36 | $_POST['target']='selection'; |
---|
| 37 | $collection = $_POST['selection']; |
---|
| 38 | |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | switch ($_POST['target']) |
---|
| 42 | { |
---|
| 43 | case 'all' : |
---|
| 44 | $collection = $page['cat_elements_id']; |
---|
| 45 | break; |
---|
| 46 | case 'selection' : |
---|
| 47 | if (!isset($_POST['selection']) or count($_POST['selection']) == 0) |
---|
| 48 | array_push($page['errors'], l10n('Select at least one picture')); |
---|
| 49 | else |
---|
| 50 | $collection = $_POST['selection']; |
---|
| 51 | break; |
---|
| 52 | } |
---|
| 53 | |
---|
[9412] | 54 | //**************** mise a jour de la base de données ************************** |
---|
| 55 | if ( $_POST['submit'] == l10n('update_database') ) { |
---|
| 56 | if ( count($collection)>0 ) { |
---|
[9377] | 57 | $lat = trim($_POST['lat']); |
---|
| 58 | $lon = trim($_POST['lon']); |
---|
| 59 | $alt = trim($_POST['alt']); |
---|
| 60 | |
---|
| 61 | if ( strlen($lat)>0 and strlen($lon)>0 ) |
---|
| 62 | { |
---|
| 63 | if ( (double)$lat<=90 and (double)$lat>=-90 |
---|
| 64 | and (double)$lon<=180 and (double)$lat>=-180 ) |
---|
| 65 | $update_query = 'lat='.$lat.', lon='.$lon; |
---|
| 66 | else |
---|
| 67 | $page['errors'][] = 'Invalid lat or lon value'; |
---|
[9412] | 68 | }else if ( strlen($lat)==0 and strlen($lon)==0 ) |
---|
[9377] | 69 | $update_query = 'lat=NULL, lon=NULL'; |
---|
| 70 | else |
---|
| 71 | $page['errors'][] = 'Both lat/lon must be empty or not empty'; |
---|
| 72 | |
---|
| 73 | if ( strlen($alt)==0) |
---|
| 74 | $update_query .= ', alt=NULL'; |
---|
| 75 | else |
---|
| 76 | $update_query .= ', alt=' .$alt ; |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | if (isset($update_query)) |
---|
| 81 | { |
---|
| 82 | $update_query = ' |
---|
| 83 | UPDATE '.IMAGES_TABLE.' SET '.$update_query.' |
---|
| 84 | WHERE id IN ('.implode(',',$collection).')'; |
---|
| 85 | pwg_query($update_query); |
---|
| 86 | cl_meta_invalidate_cache(); |
---|
| 87 | } |
---|
[9412] | 88 | } |
---|
[9377] | 89 | |
---|
[9412] | 90 | }// fin test update |
---|
[9377] | 91 | |
---|
[9412] | 92 | } // fin post |
---|
| 93 | |
---|
| 94 | |
---|
[9377] | 95 | $template->append( |
---|
| 96 | 'specials', |
---|
| 97 | array( |
---|
| 98 | $admin_url.get_query_string_diff(array('start','cat')).'&cat=caddie' => l10n('Caddie') |
---|
| 99 | ), |
---|
| 100 | true |
---|
| 101 | ); |
---|
| 102 | |
---|
| 103 | $query = ' |
---|
| 104 | SELECT id,name,uppercats,global_rank |
---|
| 105 | FROM '.CATEGORIES_TABLE.' |
---|
| 106 | ;'; |
---|
| 107 | $result = pwg_query($query); |
---|
| 108 | $categories = array(); |
---|
| 109 | $selecteds = array(); |
---|
| 110 | if (!empty($result)) |
---|
| 111 | { |
---|
| 112 | while ($row = mysql_fetch_assoc($result)) |
---|
| 113 | { |
---|
| 114 | $url = $admin_url.get_query_string_diff(array('start','cat')).'&cat='.$row['id']; |
---|
| 115 | if ( $row['id']==$_GET['cat'] ) $selecteds[] = $url; |
---|
| 116 | $row['id']=$url; |
---|
| 117 | array_push($categories, $row); |
---|
| 118 | } |
---|
| 119 | } |
---|
| 120 | usort($categories, 'global_rank_compare'); |
---|
| 121 | display_select_categories($categories, $selecteds, 'categories', false); |
---|
| 122 | |
---|
| 123 | if (!empty($_GET['display'])) |
---|
| 124 | { |
---|
| 125 | if ('all' == $_GET['display']) |
---|
| 126 | $page['nb_images'] = count($page['cat_elements_id']); |
---|
| 127 | else |
---|
| 128 | $page['nb_images'] = intval($_GET['display']); |
---|
| 129 | } |
---|
| 130 | else |
---|
| 131 | $page['nb_images'] = 20; |
---|
| 132 | |
---|
| 133 | if ( !empty($page['cat_elements_id']) ) |
---|
| 134 | { |
---|
| 135 | $nav_bar = create_navigation_bar( |
---|
| 136 | $admin_url.get_query_string_diff(array('start')), |
---|
| 137 | count($page['cat_elements_id']), |
---|
| 138 | $page['start'], |
---|
| 139 | $page['nb_images'] |
---|
| 140 | ); |
---|
| 141 | $template->assign('navbar', $nav_bar); |
---|
| 142 | } |
---|
| 143 | |
---|
| 144 | $images=array(); |
---|
| 145 | if ( !empty($page['cat_elements_id']) ) |
---|
| 146 | { |
---|
| 147 | $query=' |
---|
| 148 | SELECT id,tn_ext,name,path,file,lat,lon,alt FROM '.IMAGES_TABLE.' |
---|
| 149 | WHERE id IN ('.implode(',',$page['cat_elements_id']).') |
---|
| 150 | '.$conf['order_by'].' |
---|
| 151 | LIMIT '.$page['start'].', '.$page['nb_images'].' |
---|
| 152 | ;'; |
---|
| 153 | $result = pwg_query($query); |
---|
| 154 | while ( $row=mysql_fetch_assoc($result) ) |
---|
| 155 | $images[] = $row; |
---|
| 156 | } |
---|
| 157 | |
---|
| 158 | foreach ($images as $image) |
---|
| 159 | { |
---|
| 160 | $tpl_var = array_merge( $image, |
---|
| 161 | array( |
---|
| 162 | 'U_TN' => get_thumbnail_url($image), |
---|
| 163 | 'TITLE' => get_thumbnail_title($image) |
---|
| 164 | ) |
---|
| 165 | ); |
---|
| 166 | if ( isset($image['lat']) ) |
---|
| 167 | $tpl_var['U_MAP'] = cl_make_map_picture_url( array('image_id'=>$image['id'], 'image_file'=>$image['file']) ); |
---|
| 168 | $template->append('thumbnails', $tpl_var); |
---|
| 169 | } |
---|
| 170 | |
---|
| 171 | $template->assign( |
---|
| 172 | array( |
---|
| 173 | 'U_DISPLAY'=> $admin_url.get_query_string_diff(array('display')) |
---|
| 174 | ) |
---|
| 175 | ); |
---|
| 176 | |
---|
| 177 | //========================================================== |
---|
[9412] | 178 | if (!defined('EDIT_CL_PATH')) define( 'EDIT_CL_PATH', EDIT_CL_PATH .'admin/' ); |
---|
| 179 | $path = EDIT_CL_PATH; |
---|
[9377] | 180 | $plg_data = implode( '', file($path.'main.inc.php') ); |
---|
| 181 | if (preg_match("|Version: (.*)|", $plg_data, $val)) |
---|
[9412] | 182 | { $EDIT_CL_PATH_plugin['version'] = trim($val[1]); } |
---|
| 183 | $EDIT_CL_PATH_plugin = array_map('htmlspecialchars', $EDIT_CL_PATH_plugin); |
---|
| 184 | $version= $EDIT_CL_PATH_plugin['version'] ; |
---|
[9377] | 185 | $icon_path = 'themes/default/icon/help.png'; |
---|
| 186 | $path_js= 'themes/default/js/' ; |
---|
| 187 | |
---|
| 188 | //================================================================================== |
---|
| 189 | $match=""; |
---|
| 190 | if ( isset($_POST['submit']) ) |
---|
| 191 | { |
---|
| 192 | |
---|
[9412] | 193 | if ($_POST['submit']==l10n('update') ) |
---|
| 194 | { |
---|
| 195 | $_POST['selection']=array(); |
---|
| 196 | $collection =array(); |
---|
| 197 | unset($collection); |
---|
| 198 | } |
---|
| 199 | |
---|
[9377] | 200 | if ($_POST['submit']==l10n('Submit') ) |
---|
| 201 | { |
---|
| 202 | $_POST['selection']=array(); |
---|
| 203 | $collection =array(); |
---|
| 204 | unset($collection); |
---|
| 205 | } |
---|
| 206 | |
---|
| 207 | |
---|
| 208 | if ($_POST['submit']==l10n('reset' ) ) |
---|
| 209 | { |
---|
| 210 | $_POST['selection']=array(); |
---|
| 211 | unset($collection); |
---|
| 212 | } |
---|
| 213 | |
---|
| 214 | |
---|
| 215 | } |
---|
| 216 | //================================================================================= |
---|
| 217 | $src=""; |
---|
| 218 | $template->assign( |
---|
[9412] | 219 | array( 'EDIT_CL_PATH' => EDIT_CL_PATH, |
---|
[9377] | 220 | 'path_js' => $path_js, |
---|
| 221 | 'VERSION'=> $version, |
---|
[9412] | 222 | 'EDIT_CL_PATH_ABS' => dirname(__FILE__).'/', |
---|
[9377] | 223 | ) |
---|
| 224 | ); |
---|
| 225 | global $lang_info; |
---|
| 226 | if (date_default_timezone_get()) { $adresse = date_default_timezone_get() ;} |
---|
| 227 | else{ |
---|
| 228 | |
---|
| 229 | } |
---|
| 230 | $adresse = $lang_info['country']; ; |
---|
| 231 | $adresse=str_replace("/",", ",$adresse); |
---|
| 232 | $template->assign( 'coordinates', |
---|
| 233 | array('LAT' => '100', |
---|
| 234 | 'LON' => '100', |
---|
| 235 | 'ADRESSE' => $adresse, |
---|
| 236 | 'ZOOM' => 18, |
---|
| 237 | 'ALT' => 0 |
---|
| 238 | ) |
---|
| 239 | ); |
---|
| 240 | $filename =""; |
---|
| 241 | |
---|
| 242 | if (isset($_POST['submit']) and $_POST['submit']==l10n('selection' )) |
---|
| 243 | { |
---|
| 244 | if (isset($collection)) |
---|
| 245 | { $lat =1000; |
---|
| 246 | foreach ($collection as $id_0) { |
---|
| 247 | foreach ($images as $image) { |
---|
| 248 | if (array_search($id_0,$image)) { |
---|
| 249 | $_POST['selection'] = $collection ; |
---|
| 250 | |
---|
| 251 | $infos_gps= Get_exif_gps( $image['path'],$image) ; |
---|
| 252 | if( $image['lat'] == ''){ |
---|
| 253 | $image['lat']=$infos_gps['lat']; |
---|
| 254 | $image['lon']=$infos_gps['lon']; |
---|
| 255 | $image['alt']=$infos_gps['alt']; |
---|
| 256 | }else { |
---|
| 257 | $image['lat']=$infos_gps['lat']; |
---|
| 258 | $image['lon']=$infos_gps['lon']; |
---|
| 259 | $image['alt']=$infos_gps['alt']; |
---|
| 260 | } |
---|
| 261 | $filename= $image; |
---|
| 262 | |
---|
| 263 | |
---|
| 264 | if ($lat==1000) { |
---|
| 265 | $lat= ($image['lat'] <> '') ? $image['lat'] : '100' ; |
---|
| 266 | $lon= ($image['lon'] <> '') ? $image['lon'] : '3.0' ; |
---|
| 267 | $alt= ($image['alt'] <> '') ? $image['alt'] : '0' ; |
---|
| 268 | if($lat != '100') $lat=$image['lat']; |
---|
| 269 | //===================================================== |
---|
| 270 | $template->assign( 'coordinates', |
---|
| 271 | array('LAT' => $lat , |
---|
| 272 | 'LON' => $lon , |
---|
| 273 | 'ADRESSE' => $adresse , |
---|
| 274 | 'ZOOM' => 4, |
---|
| 275 | 'ALT' => $alt , |
---|
| 276 | ) |
---|
| 277 | ); |
---|
| 278 | } |
---|
| 279 | $lonDMS= dec2dms($lon) ; |
---|
| 280 | $latDMS= dec2dms($lat) ; |
---|
| 281 | if ($infos_gps['lat']=="") |
---|
| 282 | $icon='icon/minus.png'; |
---|
| 283 | else $icon='icon/minus.png'; |
---|
| 284 | |
---|
| 285 | $tpl_var = array_merge( |
---|
| 286 | $image, |
---|
| 287 | array( |
---|
| 288 | 'icon' => $icon , |
---|
| 289 | 'lat' => $image['lat'] , |
---|
| 290 | 'lon' => $image['lon'] , |
---|
| 291 | 'alt' => $image['alt'] , |
---|
| 292 | 'latDMS' => $latDMS[3] , |
---|
| 293 | 'lonDMS' => $lonDMS[3] , |
---|
| 294 | 'adresse' => $adresse , |
---|
| 295 | 'U_TN' => get_thumbnail_url($image), |
---|
| 296 | 'TITLE' => get_thumbnail_title($image), |
---|
| 297 | 'U_MAP' => cl_make_map_picture_url( |
---|
| 298 | array( |
---|
| 299 | 'image_id'=>$image['id'], |
---|
| 300 | 'image_file'=>$image['file'], |
---|
| 301 | ) |
---|
| 302 | |
---|
| 303 | ), |
---|
| 304 | ) |
---|
| 305 | ); |
---|
| 306 | |
---|
| 307 | $template->append('Selectthumbnails', $tpl_var); |
---|
| 308 | } |
---|
| 309 | } |
---|
| 310 | } |
---|
| 311 | } |
---|
| 312 | |
---|
| 313 | } |
---|
| 314 | |
---|
| 315 | |
---|
| 316 | if ( !empty($filename)) |
---|
| 317 | { |
---|
| 318 | // document.Envoie.latDMS.value |
---|
| 319 | $image= $filename ; |
---|
| 320 | $filename= $filename['path'] ; |
---|
| 321 | $Val_exif=""; |
---|
| 322 | $Val_XMP=""; |
---|
| 323 | // error_reporting ( 0 ); |
---|
| 324 | // Hide any unknown EXIF tags |
---|
| 325 | /* |
---|
| 326 | $GLOBALS['HIDE_UNKNOWN_TAGS'] = FALSE; |
---|
| 327 | include $Toolkit_Dir . 'Toolkit_Version.php'; // Change: added as of version 1.11 |
---|
| 328 | include $Toolkit_Dir . 'JPEG.php'; // Change: Allow this example file to be easily relocatable - as of version 1.11 |
---|
| 329 | include $Toolkit_Dir . 'JFIF.php'; |
---|
| 330 | include $Toolkit_Dir . 'PictureInfo.php'; |
---|
| 331 | include $Toolkit_Dir . 'XMP.php'; |
---|
| 332 | include $Toolkit_Dir . 'Photoshop_IRB.php'; |
---|
| 333 | include $Toolkit_Dir . 'EXIF.php'; |
---|
| 334 | |
---|
| 335 | $jpeg_header_data = get_jpeg_header_data($filename ); |
---|
| 336 | */ |
---|
| 337 | if (!empty($infos_gps)) |
---|
| 338 | $Position = $infos_gps ; |
---|
| 339 | |
---|
| 340 | else $Position = Get_exif_gps($filename,$image) ; |
---|
| 341 | |
---|
| 342 | |
---|
| 343 | |
---|
| 344 | $template->assign( array( |
---|
| 345 | 'filename_abs' => $filename , |
---|
| 346 | 'filename' => $filename, |
---|
| 347 | 'datas' => array( |
---|
| 348 | /* 'Val_JPEG_APP'=> Generate_JPEG_APP_Segment_HTML( $jpeg_header_data ), |
---|
| 349 | 'Val_intrinsic'=> Interpret_intrinsic_values_to_HTML( get_jpeg_intrinsic_values( $jpeg_header_data ) ), |
---|
| 350 | 'Val_Comment'=> Interpret_Comment_to_HTML( $jpeg_header_data ), |
---|
| 351 | 'Val_JFIF'=> Interpret_JFIF_to_HTML( get_JFIF( $jpeg_header_data ), $filename ), |
---|
| 352 | 'Val_JFXX'=>Interpret_JFXX_to_HTML( get_JFXX( $jpeg_header_data ), $filename ), |
---|
| 353 | 'Val_App12' => Interpret_App12_Pic_Info_to_HTML( $jpeg_header_data ), |
---|
| 354 | 'Val_IRB' => Interpret_IRB_to_HTML( get_Photoshop_IRB( $jpeg_header_data ), $filename ), |
---|
| 355 | |
---|
| 356 | 'Val_exif'=> Interpret_EXIF_to_HTML( get_EXIF_JPEG( $filename ), $filename), |
---|
| 357 | 'Val_XMP' => Interpret_XMP_to_HTML( read_XMP_array_from_text( get_XMP_text( $jpeg_header_data) ) ), |
---|
| 358 | */ |
---|
| 359 | // |
---|
| 360 | ), |
---|
| 361 | 'Datadase' => ($Position) , |
---|
| 362 | ) ); |
---|
| 363 | } |
---|
| 364 | |
---|
| 365 | function Memo_vars($variables) |
---|
| 366 | { |
---|
| 367 | ob_start(); |
---|
| 368 | echo '<pre>'; |
---|
| 369 | print_r($variables); |
---|
| 370 | echo '</pre>'; |
---|
| 371 | $m= ob_get_contents(); |
---|
| 372 | |
---|
| 373 | ob_end_clean(); |
---|
| 374 | return $m; |
---|
| 375 | |
---|
| 376 | } |
---|
| 377 | //======================================================================= |
---|
| 378 | function cl_make_map_picture_url($params) |
---|
| 379 | { |
---|
| 380 | global $conf; |
---|
| 381 | /*if ( empty($conf['gmaps_api_key']) and $_SERVER['SERVER_ADDR']!='127.0.0.1' ) |
---|
| 382 | return "";*/ |
---|
| 383 | $map_url = make_picture_url($params); |
---|
| 384 | return add_url_params($map_url, array('map'=>null) ); |
---|
| 385 | } |
---|
| 386 | $v1=0; |
---|
| 387 | |
---|
| 388 | |
---|
| 389 | function Get_exif_gps($filename,$image) |
---|
| 390 | { |
---|
| 391 | error_reporting ( 1 ); |
---|
| 392 | $datas = array(); |
---|
| 393 | $errors = array(); |
---|
| 394 | // |
---|
| 395 | |
---|
| 396 | // $Exif_array = get_EXIF_JPEG( $filename ); |
---|
| 397 | // if ( empty($Exif_array) ) return; |
---|
| 398 | |
---|
| 399 | $exif = @read_exif_data( $filename ); |
---|
| 400 | |
---|
| 401 | |
---|
| 402 | if ( empty($exif) ) return; |
---|
| 403 | $exif = array_intersect_key( $exif, array_flip( array('GPSLatitudeRef', 'GPSLatitude', 'GPSLongitudeRef', 'GPSLongitude', 'GPSAltitudeRef', 'GPSAltitude') ) ); |
---|
| 404 | |
---|
| 405 | |
---|
| 406 | error_reporting ( 1 ); |
---|
| 407 | /* |
---|
| 408 | if ( count($exif)<4) |
---|
| 409 | return; |
---|
| 410 | |
---|
| 411 | |
---|
| 412 | if ( !in_array($exif['GPSLatitudeRef'], array('S', 'N') ) ) |
---|
| 413 | { |
---|
| 414 | $errors[] = $filename. ': GPSLatitudeRef not S or N'; |
---|
| 415 | return; |
---|
| 416 | } |
---|
| 417 | if ( !in_array($exif['GPSLongitudeRef'], array('W', 'E') ) ) |
---|
| 418 | { |
---|
| 419 | $errors[] = $filename. ': GPSLongitudeRef not W or E'; |
---|
| 420 | return; |
---|
| 421 | } |
---|
| 422 | if (!is_array($exif['GPSLatitude']) or !is_array($exif['GPSLongitude']) ) |
---|
| 423 | { |
---|
| 424 | $errors[] = $filename. ': GPSLatitude and GPSLongitude are not arrays'; |
---|
| 425 | return; |
---|
| 426 | } |
---|
| 427 | */ |
---|
| 428 | |
---|
| 429 | |
---|
| 430 | $lat = $image['lat'] ; |
---|
| 431 | $lon = $image['lon'] ; |
---|
| 432 | $alt=$image['alt']; |
---|
| 433 | |
---|
| 434 | if ($lat =="") |
---|
| 435 | { |
---|
| 436 | $lat = Parse_Lat_Lon( $exif['GPSLatitude'] ); |
---|
| 437 | if ( $exif['GPSLatitudeRef']=='S' )$lat = -$lat; |
---|
| 438 | $latDMS=$exif['GPSLatitude'][0] . " | " . $exif['GPSLatitude'][1]. " | " . $exif['GPSLatitude'][2] ; |
---|
| 439 | |
---|
| 440 | }else{ |
---|
| 441 | |
---|
| 442 | if($lat<0) $exif['GPSLatitudeRef']='S' ; |
---|
| 443 | else $exif['GPSLatitudeRef']='N' ; |
---|
| 444 | $latDMS=dec2dms($lat); |
---|
| 445 | $exif['GPSLatitude']= $latDMS ; |
---|
| 446 | } |
---|
| 447 | global $errors; |
---|
| 448 | if (!is_array($exif['GPSLatitude']) or !is_array($exif['GPSLongitude']) ) |
---|
| 449 | { |
---|
| 450 | $errors[] = $filename. ': GPSLatitude and GPSLongitude are not arrays'; |
---|
| 451 | //return; |
---|
| 452 | } |
---|
| 453 | |
---|
| 454 | if ($lon =="") { |
---|
| 455 | |
---|
| 456 | $lon = parse_lat_lon( $exif['GPSLongitude'] ); |
---|
| 457 | $lonDMS= $exif['GPSLongitude'][0] . " | " . $exif['GPSLongitude'][1] . " | " . $exif['GPSLongitude'][2] ; |
---|
| 458 | if ( $exif['GPSLongitudeRef']=='W' ) $lon = -$lon; |
---|
| 459 | }else{ |
---|
| 460 | if ($lon<0) $exif['GPSLongitudeRef'] ='W' ; |
---|
| 461 | else $exif['GPSLongitudeRef'] ='E' ; |
---|
| 462 | $lonDMS=dec2dms($lon); |
---|
| 463 | $exif['GPSLongitude']=$lonDMS ; |
---|
| 464 | } |
---|
| 465 | |
---|
| 466 | |
---|
| 467 | |
---|
| 468 | //======================================================================= |
---|
| 469 | $altref = 0; |
---|
| 470 | |
---|
| 471 | if (!is_array($exif['GPSAltitude']) or !is_array($exif['GPSAltitudeRef']) ) |
---|
| 472 | { |
---|
| 473 | $exif['GPSAltitude']=$alt; |
---|
| 474 | $exif['GPSAltitudeRef']=0; |
---|
| 475 | } else { |
---|
| 476 | $alt = $exif['GPSAltitude']; |
---|
| 477 | $altref = $exif['GPSAltitudeRef']; |
---|
| 478 | } |
---|
| 479 | //======================================================================== |
---|
| 480 | |
---|
| 481 | $datas[] = array ( |
---|
| 482 | ' filename=' => $filename , |
---|
| 483 | 'id' => $image['id'] , |
---|
| 484 | 'lat' => $lat , |
---|
| 485 | 'lon' => $lon , |
---|
| 486 | 'latDMS' => $exif['GPSLatitude'][0]['Numerator'] . "/" . |
---|
| 487 | $exif['GPSLatitude'][0]['Denominator'] . " " . |
---|
| 488 | $exif['GPSLatitude'][1]['Numerator'] . "/" . |
---|
| 489 | $exif['GPSLatitude'][1]['Denominator']. " " . |
---|
| 490 | $exif['GPSLatitude'][2]['Numerator'] . "/" . |
---|
| 491 | $exif['GPSLatitude'][2]['Denominator'], |
---|
| 492 | 'lonDMS' => $exif['GPSLongitude'][0]['Numerator'] . "/" . |
---|
| 493 | $exif['GPSLongitude'][0]['Denominator'] . " " . |
---|
| 494 | $exif['GPSLongitude'][1]['Numerator'] . "/" . |
---|
| 495 | $exif['GPSLongitude'][1]['Denominator']. " " . |
---|
| 496 | $exif['GPSLongitude'][2]['Numerator'] . "/" . |
---|
| 497 | $exif['GPSLongitude'][2]['Denominator'], |
---|
| 498 | 'altref' => $exif['GPSAltitudeRef'], |
---|
| 499 | 'alt' => $exif['GPSAltitude'] , |
---|
| 500 | |
---|
| 501 | ); |
---|
| 502 | |
---|
| 503 | return $datas[0] ; |
---|
| 504 | } |
---|
| 505 | ?> |
---|