Changeset 25801
- Timestamp:
- Dec 6, 2013, 8:14:44 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/functions_metadata.php
r25018 r25801 123 123 array_merge( 124 124 $update_fields, 125 array_keys($conf['use_exif_mapping']) 125 array_keys($conf['use_exif_mapping']), 126 array('latitude', 'longitude') 126 127 ); 127 128 } -
trunk/include/functions_metadata.inc.php
r25550 r25801 153 153 if ($exif = @read_exif_data($filename)) 154 154 { 155 $exif = trigger_event('format_exif_data', $exif, $filename, $map ); 155 $exif = trigger_event('format_exif_data', $exif, $filename, $map); 156 157 // configured fields 156 158 foreach ($map as $key => $field) 157 159 { … … 170 172 $result[$key] = $exif[$tokens[0]][$tokens[1]]; 171 173 } 174 } 175 } 176 177 // GPS data 178 $gps_exif = array_intersect_key($exif, array_flip(array('GPSLatitudeRef', 'GPSLatitude', 'GPSLongitudeRef', 'GPSLongitude'))); 179 if (count($gps_exif) == 4) 180 { 181 if ( 182 is_array($gps_exif['GPSLatitude']) and in_array($gps_exif['GPSLatitudeRef'], array('S', 'N')) and 183 is_array($gps_exif['GPSLongitude']) and in_array($gps_exif['GPSLongitudeRef'], array('W', 'E')) 184 ) 185 { 186 $result['latitude'] = parse_exif_gps_data($gps_exif['GPSLatitude'], $gps_exif['GPSLatitudeRef']); 187 $result['longitude'] = parse_exif_gps_data($gps_exif['GPSLongitude'], $gps_exif['GPSLongitudeRef']); 172 188 } 173 189 } … … 187 203 } 188 204 205 206 /** 207 * Converts EXIF GPS format to a float value. 208 * @since 2.6 209 * 210 * @param string[] $raw eg: 211 * - 41/1 212 * - 54/1 213 * - 9843/500 214 * @param string $ref 'S', 'N', 'E', 'W'. eg: 'N' 215 * @return float eg: 41.905468 216 */ 217 function parse_exif_gps_data($raw, $ref) 218 { 219 foreach ($raw as &$i) 220 { 221 $i = explode('/', $i); 222 $i = $i[1]==0 ? 0 : $i[0]/$i[1]; 223 } 224 unset($i); 225 226 $v = $raw[0] + $raw[1]/60 + $raw[2]/3600; 227 228 $ref = strtoupper($ref); 229 if ($ref == 'S' or $ref == 'W') $v= -$v; 230 231 return $v; 232 } 233 189 234 ?> -
trunk/install/piwigo_structure-mysql.sql
r22879 r25801 197 197 `md5sum` char(32) default NULL, 198 198 `added_by` smallint(5) NOT NULL default '0', 199 `rotation` tinyint unsigned default null, 199 `rotation` tinyint unsigned default NULL, 200 `latitude` double(8, 6) default NULL, 201 `longitude` double(9, 6) default NULL, 200 202 PRIMARY KEY (`id`), 201 203 KEY `images_i2` (`date_available`), … … 203 205 KEY `images_i4` (`hit`), 204 206 KEY `images_i5` (`date_creation`), 205 KEY `images_i1` (`storage_category_id`) 207 KEY `images_i1` (`storage_category_id`), 208 KEY `images_i6` (`latitude`) 206 209 ) ENGINE=MyISAM; 207 210
Note: See TracChangeset
for help on using the changeset viewer.