Changeset 12126 for extensions/edit_gmaps/admin/include/fonctions.php
- Timestamp:
- Sep 10, 2011, 5:02:19 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/edit_gmaps/admin/include/fonctions.php
r9412 r12126 1 1 <?php 2 // 3 // DECIMAL TO FRACTION 4 // 2 3 function base_to_meta($image){ 4 $info_meta['lat']=$image['lat']; 5 $info_meta['lon']=$image['lon']; 6 $info_meta['alt']=$image['alt']; 7 //=========================================================================== 8 $info_meta['latRef'] = ($image['lat']<0)? 'S' : "N" ; 9 $info_meta['GPSLatitudeRef'] = ($image['lat']<0)? 'S' : "N" ; 10 $p1=dec2dms($image['lat']); 11 12 $info_meta['latDMS']=$p1[0]['Numerator'] . "/" . 13 $p1[0]['Denominator'] ." ". 14 $p1[1]['Numerator'] . "/" . 15 $p1[1]['Denominator'] ." ". 16 $p1[2]['Numerator'] . "/" . 17 $p1[2]['Denominator'] ; 18 19 $info_meta['GPSLatitude']=array( 20 $p1[0]['Numerator'] . "/" . 21 $p1[0]['Denominator'] , 22 $p1[1]['Numerator'] . "/" . 23 $p1[1]['Denominator'] , 24 $p1[2]['Numerator'] . "/" . 25 $p1[2]['Denominator'] 26 ); 27 28 //=========================================================================== 29 $info_meta['GPSLongitudeRef'] = ($image['lon']<0)? 'W' : "E" ; 30 $info_meta['lonRef'] = ($image['lon']<0)? 'W' : "E" ; 31 $p1=dec2dms($image['lon']); 32 $info_meta['lonDMS']=$p1[0]['Numerator'] . "/" . 33 $p1[0]['Denominator'] ." ". 34 $p1[1]['Numerator'] . "/" . 35 $p1[1]['Denominator'] ." ". 36 $p1[2]['Numerator'] . "/" . 37 $p1[2]['Denominator'] ; 38 $info_meta['GPSLongitude']=array( 39 $p1[0]['Numerator'] . "/" . 40 $p1[0]['Denominator'] , 41 $p1[1]['Numerator'] . "/" . 42 $p1[1]['Denominator'] , 43 $p1[2]['Numerator'] . "/" . 44 $p1[2]['Denominator'] 45 ); 46 //=========================================================================== 47 $info_meta['GPSAltitudeRef'] = "0"; 48 $p1= round( $image['alt'] * 5000000000 ); 49 $info_meta['GPSAltitude']= $p1.'/'."500000000000"; 50 $info_meta['altDMS']= $p1.'/'."500000000000"; 51 $info_meta['altRef']= "0"; 52 return $info_meta ; 53 } 54 55 /********************************** 56 * DECIMAL TO FRACTION * 57 **********************************/ 5 58 function dec2frac( $decimal ) { 6 59 $decimal = (string)$decimal; … … 10 63 11 64 // find least reduced fractional form of number 12 for( $i = 0, $ix = strlen( $decimal ); $i < $ix; $i++ ) 13 { 65 for( $i = 0, $ix = strlen( $decimal ); $i < $ix; $i++ ){ 14 66 // build the denominator as we 'shift' the decimal to the right 15 67 if( $dec ) $den *= 10; … … 42 94 } 43 95 44 96 /********************************** 97 * Decimal vers Deg Min Sec * 98 **********************************/ 45 99 function dec2dms($value) { 46 100 $value= abs($value); … … 59 113 $ret[2]['Denominator']=$sec->Denominator; 60 114 $ret[3]= " Deg: " . $degrees . " Min: " . $minutes . " Sec: " . $seconds." " ; 61 115 $ret[4]= " " . $degrees . "/1 " . $minutes . "/1 " . $sec->Numerator."/".$sec->Denominator ; 62 116 return( $ret); 63 117 64 118 } 65 119 66 67 /*68 //Array (69 [GPSLatitudeRef] => S70 [GPSLatitude] =>71 Array ( [0] => 41/172 [1] => 54/173 [2] => 26543/3238 )74 [GPSLongitudeRef] => E75 [GPSLongitude] => Array (76 [0] => 146/177 [1] => 21/178 [2] => 61393/1729 ) )79 */80 120 81 121 function toFraction($number){ … … 108 148 return ($denominator > 0) ? $numerator . '/' . $denominator : false; 109 149 } 110 111 function Parse_Fract( $f ) 112 { 150 //============================================== 151 function Parse_Fract( $f ){ 113 152 $nd = explode( '/', $f ); 114 153 return $nd[0]/$nd[1];
Note: See TracChangeset
for help on using the changeset viewer.