Ticket #9257: 9257.patch
File 9257.patch, 1.7 KB (added by , 14 years ago) |
---|
-
wp-admin/includes/image.php
213 213 } 214 214 215 215 /** 216 * Convert the exif geo longitude and latitude format from degrees, minutes and 217 * seconds to a float degrees. 218 * 219 * @since 2.7.0 220 * 221 * @param string $geo 222 * @return float 223 */ 224 function wp_exif_gpsconvert($geo) { 225 @list( $degree, $minute, $second ) = $geo; 226 $float = wp_exif_frac2dec($degree) + (wp_exif_frac2dec($minute)/60) + (wp_exif_frac2dec($second)/3600); 227 228 return is_float($float) ? $float : 999; 229 } 230 231 /** 216 232 * Get extended image metadata, exif or iptc as available. 217 233 * 218 234 * Retrieves the EXIF metadata aperture, credit, camera, caption, copyright, iso … … 249 265 'iso' => 0, 250 266 'shutter_speed' => 0, 251 267 'title' => '', 268 'gps_longitude' => 999, 269 'gps_latitude' => 999, 252 270 ); 253 271 254 272 // read iptc first, since it might contain data not available in exif such … … 287 305 $meta['iso'] = $exif['ISOSpeedRatings']; 288 306 if (!empty($exif['ExposureTime'])) 289 307 $meta['shutter_speed'] = wp_exif_frac2dec( $exif['ExposureTime'] ); 308 if (!empty($exif['GPSLongitude']) && count($exif['GPSLongitude']) == 3 && !empty($exif['GPSLongitudeRef'])) 309 $meta['gps_longitude'] = ($exif['GPSLongitudeRef']== 'W' ? '-' : '') . wp_exif_gpsconvert( $exif['GPSLongitude'] ); 310 if (!empty($exif['GPSLatitude']) && count($exif['GPSLatitude']) == 3 && !empty($exif['GPSLatitudeRef'])) 311 $meta['gps_latitude'] = ($exif['GPSLatitudeRef']== 'S' ? '-' : '') . wp_exif_gpsconvert( $exif['GPSLatitude'] ); 290 312 } 291 313 292 314 return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType );