Hello/Hi/Greetings,
The original topic 'DateTimeOriginal exif metadata not synced from video' was deleted, so I start a new:
Since version 13c of the piwigo-videojs - plugin a correct 'MediaCreateDate' is no longer synced to the 'date_creation' field in the _images database nor in th image_videojs database.
the working code in file 'exiftool.php' in version 15b is:
if (isset($general['MediaCreateDate']))
{
$exif['date_creation'] = date('Y-m-d H:i:s', strtotime((string)$general['MediaCreateDate']));
}and the not working code in version 15e (newest) is:
if (isset($general['MediaCreateDate']))
{
if (str_contains($general['MediaCreateDate'], ':'))
{
if ((strcmp($general['MediaCreateDate'], "0000:00:00 00:00:00") !== 0) and
($timestamp = strtotime($general['MediaCreateDate'])) === true)
{
$exif['date_creation'] = date('Y-m-d H:i:s', strtotime($timestamp));
}
}
else
{
$exif['date_creation'] = date('Y-m-d H:i:s', substr($general['MediaCreateDate'], 0, 10));
}
}So I changed the following 2 lines:
// if ((strcmp($general['MediaCreateDate'], "0000:00:00 00:00:00") !== 0) and
// ($timestamp = strtotime($general['MediaCreateDate'])) === true)
if ((strcmp($general['MediaCreateDate'], "0000:00:00 00:00:00") !== 0) and
($timestamp = strtotime($general['MediaCreateDate'])) !== false), because strtotime() can never be true
and
// $exif['date_creation'] = date('Y-m-d H:i:s', strtotime($timestamp));
$exif['date_creation'] = date('Y-m-d H:i:s', $timestamp);,
because $timestamp contains already the correct string
I'm not a coder, so I can't say if this is correct. At least it works for me.
Could someone (EddyLB) please have a look at this.
Thank's
Server-Umgebung
Piwigo 15.5.0 Prüfen, ob eine neue Version verfügbar ist.
Installiert auf 5 Mai 2025, vor 1 Tag
Betriebssystem: Linux
PHP: 8.1.31-nmm1 (Info anzeigen) [2025-05-06 13:27:47]
MySQL: 10.11.11-MariaDB-0ubuntu0.24.04.2-log [2025-05-06 13:27:47]
Grafikbibliothek: ImageMagick ImageMagick 6.9.12-98
Größe des Cache nicht vorhanden nie berechnet Aktualisieren
Liste der aktivierten Plugins 2
LocalFiles Editor
VideoJS
Offline
Thanks for the suggestions.
Offline
The test is right because it checks that $timestamp is set, not that strtotime() returns true.
The problem is that strtotime() is mistakenly applied to $timestamp when $exif is defined.
The code should be:
if ((strcmp($general['MediaCreateDate'], "0000:00:00 00:00:00") !== 0) and
($timestamp = strtotime((string)$general['MediaCreateDate'])))
{
$exif['date_creation'] = date('Y-m-d H:i:s', $timestamp);
}Offline
That's it!
Thanks for your work!
Offline