•  » Extensions
  •  » MediaCreateDate is not synced to date_creation

#1 2025-05-06 13:29:20

gueba
Member
2021-12-31
66

MediaCreateDate is not synced to date_creation

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:

Code:

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:

Code:

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:

Code:

//   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

Code:

//      $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

 

#2 2025-05-11 19:39:32

cryopad
Piwigo Team
Grenoble, France
2015-11-01
211

Re: MediaCreateDate is not synced to date_creation

Thanks for the suggestions.


If you enjoy Piwigo for iOS…
➤ We would appreciate an AppStore review.
➤ Comments, suggestions ? Tell us on GitHub…
➤ Not yet available in your language ? Help us translate it…

Offline

 
  •  » Extensions
  •  » MediaCreateDate is not synced to date_creation

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2025 · Contact