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).
Bawolff created this task.Oct 23 2013, 7:49 PM
Jdforrester-WMF moved this task from Untriaged to Backlog on the Multimedia board.Sep 4 2015, 6:38 PM
Restricted Application added subscribers: Steinsplitter, Matanya, Aklapper. · View Herald TranscriptSep 4 2015, 6:38 PM
Galorefitz added a subscriber: Galorefitz.

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.

Alright, thanks! :)

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 project: Commons. · View Herald TranscriptJan 27 2017, 10:16 PM
Restricted Application added a subscriber: TerraCodes. · View Herald Transcript
Framawiki moved this task from Backlog to Doing on the good first task board.Dec 2 2017, 1:41 PM
TheDJ added a subscriber: TheDJ.Sep 12 2019, 9:44 AM
Galorefitz removed Galorefitz as the assignee of this task.Mar 21 2020, 3:45 AM