Page MenuHomePhabricator

PNG metadata extractor doesn't properly convert dates
Open, MediumPublic

Description

Its supposed to convert timestamps to EXIF format (as that's what the other metadata code expects). Currently its not. Seems to be an issue with failing on the timezone specifier. Possibly it previously worked, but changes to MW's wfTimestamp code caused it to no longer work. Or maybe its always been broken.

Anyhow, minor issue, but should be addressed. Possibly should be addressed by making wfTimestamp handle timezones.


Version: 1.22.0
Severity: normal

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:28 AM
bzimport set Reference to bz56064.
bzimport added a subscriber: Unknown Object (MLST).
Galorefitz subscribed.

Hi!
So I looked around for what exactly was wrong. Turns out it is converting the dates to EXIF format. Lots of PNG files I came across that did not have a modification time, but when I ran it on one that did, this was the var-dump:

array(6) {
  ["frameCount"]=>
  int(0)
  ["loopCount"]=>
  int(1)
  ["duration"]=>
  float(0)
  ["text"]=>
  array(4) {
    ["XResolution"]=>
    string(8) "2800/100"
    ["YResolution"]=>
    string(8) "2800/100"
    ["ResolutionUnit"]=>
    int(3)
    ["DateTime"]=>
    string(19) "2015:09:13 19:19:52"
  }
  ["bitDepth"]=>
  int(8)
  ["colorType"]=>
  string(10) "truecolour"
}

I also read these comments:

// @todo FIXME: Currently timezones are ignored.
// possibly should be wfTimestamp's
// responsibility. (at least for numeric TZ)

So do you want only timezones implemented? And if so, which timezone?

So do you want only timezones implemented? And if so, which timezone?

We want timezone specifiers handled.

So ideally 1997-07-16T19:20:30+01:00 should get turned into 1997:07:16 19:19:30

Probably best to let MWTimestamp recognize time zone specifiers.

So ideally 1997-07-16T19:20:30+01:00 should get turned into 1997:07:16 19:19:30

I don't understand why the minutes field is changing instead of the hours field. Could you please explain?

d'oh, you're right, I should have said

1997-07-16T19:20:30+01:00 should get turned into 1997:07:16 18:20:30

Change 239292 had a related patch set uploaded (by Galorefitz):
[WIP] Handle timezone specifiers in MWTimestamp

https://gerrit.wikimedia.org/r/239292

Restricted Application added a subscriber: TerraCodes. · View Herald Transcript

Change 239292 abandoned by Thiemo Kreuz (WMDE):
[mediawiki/core@master] Handle timezone specifiers for PNG metadata in MWTimestamp

Reason:
5 years old. User appears to be inactive. Please feel free to reopen this patch if I made a mistake.

https://gerrit.wikimedia.org/r/239292