WordPress.org

Make WordPress Core

Ticket #14137: 14137.diff

File 14137.diff, 976 bytes (added by Otto42, 7 years ago)

Patch to use DateTimeOriginal and/or DateTime in preference to DateTimeDigitized

  • wp-admin/includes/image.php

     
    292292                        $meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 );
    293293                if ( ! empty($exif['Model'] ) )
    294294                        $meta['camera'] = utf8_encode( trim( $exif['Model'] ) );
    295                 if ( ! empty($exif['DateTimeDigitized'] ) )
     295                       
     296                if ( ! empty($exif['DateTimeOriginal'] ) )
     297                        $meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeOriginal'] );
     298                else if ( ! empty($exif['DateTime'] ) )
     299                        $meta['created_timestamp'] = wp_exif_date2ts($exif['DateTime'] );
     300                else if ( ! empty($exif['DateTimeDigitized'] ) )
    296301                        $meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeDigitized'] );
     302                       
    297303                if ( ! empty($exif['FocalLength'] ) )
    298304                        $meta['focal_length'] = wp_exif_frac2dec( $exif['FocalLength'] );
    299305                if ( ! empty($exif['ISOSpeedRatings'] ) )