Ticket #14137: 14137.diff

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

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

Line 
1Index: wp-admin/includes/image.php
2===================================================================
3--- wp-admin/includes/image.php (revision 17316)
4+++ wp-admin/includes/image.php (working copy)
5@@ -292,8 +292,14 @@
6                        $meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 );
7                if ( ! empty($exif['Model'] ) )
8                        $meta['camera'] = utf8_encode( trim( $exif['Model'] ) );
9-               if ( ! empty($exif['DateTimeDigitized'] ) )
10+                       
11+               if ( ! empty($exif['DateTimeOriginal'] ) )
12+                       $meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeOriginal'] );
13+               else if ( ! empty($exif['DateTime'] ) )
14+                       $meta['created_timestamp'] = wp_exif_date2ts($exif['DateTime'] );
15+               else if ( ! empty($exif['DateTimeDigitized'] ) )
16                        $meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeDigitized'] );
17+                       
18                if ( ! empty($exif['FocalLength'] ) )
19                        $meta['focal_length'] = wp_exif_frac2dec( $exif['FocalLength'] );
20                if ( ! empty($exif['ISOSpeedRatings'] ) )