Changeset 28367
- Timestamp:
- 05/11/2014 05:53:27 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/image.php
r27997 r28367 323 323 $exif = @exif_read_data( $file ); 324 324 325 if ( !empty( $exif['Title'] ) )325 if ( empty( $meta['title'] ) && ! empty( $exif['Title'] ) ) { 326 326 $meta['title'] = trim( $exif['Title'] ); 327 } 327 328 328 329 if ( ! empty( $exif['ImageDescription'] ) ) { … … 330 331 // Assume the title is stored in ImageDescription 331 332 $meta['title'] = trim( $exif['ImageDescription'] ); 332 if ( ! empty( $exif['COMPUTED']['UserComment'] ) && trim( $exif['COMPUTED']['UserComment'] ) != $meta['title'] )333 if ( empty( $meta['caption'] ) && ! empty( $exif['COMPUTED']['UserComment'] ) && trim( $exif['COMPUTED']['UserComment'] ) != $meta['title'] ) { 333 334 $meta['caption'] = trim( $exif['COMPUTED']['UserComment'] ); 334 } elseif ( trim( $exif['ImageDescription'] ) != $meta['title'] ) { 335 } 336 } elseif ( empty( $meta['caption'] ) && trim( $exif['ImageDescription'] ) != $meta['title'] ) { 335 337 $meta['caption'] = trim( $exif['ImageDescription'] ); 336 338 } 337 } elseif ( ! empty( $exif['Comments'] ) && trim( $exif['Comments'] ) != $meta['title'] ) {339 } elseif ( empty( $meta['caption'] ) && ! empty( $exif['Comments'] ) && trim( $exif['Comments'] ) != $meta['title'] ) { 338 340 $meta['caption'] = trim( $exif['Comments'] ); 339 341 } 340 342 341 if ( ! empty( $exif['Artist'] ) ) 342 $meta['credit'] = trim( $exif['Artist'] ); 343 elseif ( ! empty($exif['Author'] ) ) 344 $meta['credit'] = trim( $exif['Author'] ); 345 346 if ( ! empty( $exif['Copyright'] ) ) 343 if ( empty( $meta['credit'] ) ) { 344 if ( ! empty( $exif['Artist'] ) ) { 345 $meta['credit'] = trim( $exif['Artist'] ); 346 } elseif ( ! empty($exif['Author'] ) ) { 347 $meta['credit'] = trim( $exif['Author'] ); 348 } 349 } 350 351 if ( empty( $meta['copyright'] ) && ! empty( $exif['Copyright'] ) ) { 347 352 $meta['copyright'] = trim( $exif['Copyright'] ); 348 if ( ! empty($exif['FNumber'] ) ) 353 } 354 if ( ! empty( $exif['FNumber'] ) ) { 349 355 $meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 ); 350 if ( ! empty($exif['Model'] ) ) 356 } 357 if ( ! empty( $exif['Model'] ) ) { 351 358 $meta['camera'] = trim( $exif['Model'] ); 352 if ( ! empty($exif['DateTimeDigitized'] ) ) 353 $meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeDigitized'] ); 354 if ( ! empty($exif['FocalLength'] ) ) 359 } 360 if ( empty( $meta['created_timestamp'] ) && ! empty( $exif['DateTimeDigitized'] ) ) { 361 $meta['created_timestamp'] = wp_exif_date2ts( $exif['DateTimeDigitized'] ); 362 } 363 if ( ! empty( $exif['FocalLength'] ) ) { 355 364 $meta['focal_length'] = (string) wp_exif_frac2dec( $exif['FocalLength'] ); 356 if ( ! empty($exif['ISOSpeedRatings'] ) ) { 365 } 366 if ( ! empty( $exif['ISOSpeedRatings'] ) ) { 357 367 $meta['iso'] = is_array( $exif['ISOSpeedRatings'] ) ? reset( $exif['ISOSpeedRatings'] ) : $exif['ISOSpeedRatings']; 358 368 $meta['iso'] = trim( $meta['iso'] ); 359 369 } 360 if ( ! empty( $exif['ExposureTime'] ) )370 if ( ! empty( $exif['ExposureTime'] ) ) { 361 371 $meta['shutter_speed'] = (string) wp_exif_frac2dec( $exif['ExposureTime'] ); 372 } 362 373 } 363 374 364 375 foreach ( array( 'title', 'caption', 'credit', 'copyright', 'camera', 'iso' ) as $key ) { 365 if ( $meta[ $key ] && ! seems_utf8( $meta[ $key ] ) ) 376 if ( $meta[ $key ] && ! seems_utf8( $meta[ $key ] ) ) { 366 377 $meta[ $key ] = utf8_encode( $meta[ $key ] ); 378 } 367 379 } 368 380
Note: See TracChangeset
for help on using the changeset viewer.