WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 3 years ago

#14137 new enhancement

EXIF tag DateTimeDigitized not always present

Reported by: MMN-o Owned by:
Milestone: Future Release Priority: normal
Severity: minor Version: 3.0
Component: Upload Keywords: has-patch
Focuses: Cc:

Description (last modified by nacin)

Shooting images with my Nokia N900 will only fill in EXIF data for "DateTimeOriginal", not the tag "DateTimeDigitized" which Wordpress solely uses.

Grabbing data from DateTime and/or DateTimeOriginal would increase the amounts of correct EXIF date data collected when uploading images.

Attaching sample original image from my camera. CLI tool 'exif' when grep:ed with 'Date' outputs the following for the attached image:

Date and Time       |2010:06:25 15:47:14
Date and Time (origi|2010:06:25 15:47:14

'exif --list-tags *jpg|grep Date' results in the following (* meaning data exists):

  0x0132 Date and Time                   *      -      -      -      -   
  0x9003 Date and Time (original)        -      -      *      -      -   
  0x9004 Date and Time (digitized)       -      -      -      -      -  

wp-admin/includes/image.php has the function which retrieves this metadata.

Attachments (1)

14137.diff (976 bytes) - added by Otto42 3 years ago.
Patch to use DateTimeOriginal and/or DateTime in preference to DateTimeDigitized

Download all attachments as: .zip

Change History (14)

comment:1 MMN-o4 years ago

File not attached, but linked here:
http://ccou.se/files/2010/06/20100625_015.jpg

comment:2 MMN-o4 years ago

  • Keywords DateTime added

comment:3 MMN-o4 years ago

  • Keywords image added
  • Summary changed from EXIF DateTimeDigitized not always presented to EXIF tag DateTimeDigitized not always present

comment:4 nacin4 years ago

  • Description modified (diff)

comment:5 nacin4 years ago

  • Cc miqrogroove@… added
  • Keywords needs-patch added; n900 DateTimeDigitized DateTime DateTimeOriginal EXIF camera image removed
  • Milestone changed from Awaiting Review to Future Release

No issues adding the extra field here.

comment:6 miqrogroove4 years ago

Ah, nice ticket. This could be patched up in an hour or two. I would first want to see why there are three different date fields and whether all three should be recognized instead of just one or two. I simply have zero time to devote as I'm back in school with five papers due by mid Nov.

comment:7 MMN-o4 years ago

Great that someone woke this ticket to life. I had no means whatsoever when I posted it to delve into the issue, but I'll give it a shot now if miqrogroove doesn't make it first :)

It seems DateTimeDigitized tells us when an image was digitized, as opposed to DateTimeOriginal which tells us when it was originally _created_. That is, an analog picture which was scanned should have different DateTimeOriginal and DateTimeDigitized, whereas a digital still image reasonably has identical timestamps.

http://www.awaresystems.be/imaging/tiff/tifftags/privateifd/exif/datetimedigitized.html

The priority list for Wordpress to interpret EXIF timestamp should be:

  1. DateTimeOriginal (This is when the image was first created. Should override everything.)
  2. DateTime (I'm guessing this is most common, and more likely to represent correct time than digitization)
  3. DateTimeDigitized (if no other data is available, assume digitization equals time of creation)

comment:8 miqrogroove4 years ago

I looked up and confirmed 0x132 DateTime represents the time of the last edit. It is not the correct value to assign to $meta['created_timestamp'].

There may be no significant distinction between the Digitized and Original fields, so I would favor Digitized and fall back on Original for consistency. The camera in question appears to be out of compliance with Exif.

Otto423 years ago

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

comment:9 Otto423 years ago

  • Keywords has-patch added; needs-patch removed

In looking through some photos, I found DateTimeOriginal and DateTimeDigitized generally contained the same values, and either one or the other existed.

For simplicity, I say we favor things in the order given by MMN-o. Patch does just that.

comment:10 miqrogroove3 years ago

I still disagree with the idea of changing this behavior such an arbitrary manner.

comment:11 Otto423 years ago

Well, I could compile some stats and such across the whole of the internet if you liked, but in the ones I checked via my totally non-scientific sample, there was no "DateTime", but "DateTimeOriginal" and "DateTimeDigitized" were fairly commonplace.

"DateTimeOriginal" has been around a long time.
"DateTimeDigitized" has been around since digital cameras got to the point of non-suck.
"DateTime" doesn't exist as far as I've seen. But I admit that I didn't try very hard to find it.

The order is irrelevant, as I see it. Choose your own and I'll back it. But it should definitely check for more than one of them.

comment:12 miqrogroove3 years ago

  1. DateTimeDigitized
  2. DateTimeOriginal

comment:13 Otto423 years ago

Given the same general principle as I stated in #16251: "the attachment post is the representation in WordPress of the attachment file", then it makes more sense for the "Original" date to be assigned to the created_timestamp, over the "Digitized".

That said, in practice, it probably doesn't make any difference at all in the grand scheme of things. The number of cases where Original is different than Digitized is probably capable of being counting on fingers.

Note: See TracTickets for help on using tickets.