[metadata] TimeCreated not used when importing DateCreated IPTC field #860

Open
opened 2026-10-05 00:21:34 +02:00 by adam · 3 comments
Owner

When uploading files and syncing the metadata, Piwigo seems only to be checking the DateCreated IPTC field and not using the TimeCreated field along with it. As a result, in the database the date_creation field on the images table is midnight (00:00:00).

For example, here's a file with some IPTC fields set:

image

Notice the date/time of 02/01/2019 18:12:00. When the file is uploaded to Piwigo, the date is missing the time:

image

But the read metadata plugin properly "sees" the time:

image

It would be nice if the time is loaded into the date_creation field along with the date.

When uploading files and syncing the metadata, Piwigo seems only to be checking the DateCreated IPTC field and not using the TimeCreated field along with it. As a result, in the database the date_creation field on the images table is midnight (00:00:00). For example, here's a file with some IPTC fields set: ![image](https://user-images.githubusercontent.com/11047158/53307217-2038f700-3864-11e9-86d6-d1a90ee300b1.png) Notice the date/time of 02/01/2019 18:12:00. When the file is uploaded to Piwigo, the date is missing the time: ![image](https://user-images.githubusercontent.com/11047158/53307225-42cb1000-3864-11e9-847d-f14588d272d2.png) But the read metadata plugin properly "sees" the time: ![image](https://user-images.githubusercontent.com/11047158/53307233-4eb6d200-3864-11e9-89ba-90391220845d.png) It would be nice if the time is loaded into the date_creation field along with the date. <!-- github-sync-id:413884654 -->
Author
Owner

If EXIF information is available, the date/time is properly loaded. This just seems to be when relying on IPTC fields.

If EXIF information is available, the date/time is properly loaded. This just seems to be when relying on IPTC fields. <!-- github-comment-id:466831759 -->
Author
Owner

My observation is different. The Creation Date is also set to hh:mm = 00:00, if the DateTimeOriginal is populated in EXIF and visible with the Read metadata plugin:

EXIF Fields in 20240923-092607-0811.jpg

FileName = 20240930181824-f437b537.jpg
FileDateTime = 1727713104
[...]
ExifVersion = 0231
DateTimeOriginal = 2024:09:23 09:26:07
DateTimeDigitized = 2024:09:23 09:26:07
[...]

I see following behaviour:

  • If I upload my photos by means of the Digikam -> Piwigo Export function, the Creation Date includes the correct hh:mm values.
  • if I upload via the DOMAINNAME/admin.php?page=photos_add URL the time is set to zero, but in the Information link to the photo, the correct value of DateTimeOriginal appears under EXIF Metadata.
  • if I have a correct Creation Date and I apply the Synchronize metadata Action in the Batch Manager, the time is set to zero as well

Environment

  • Piwigo 14.5.0
  • Installed on 26 December 2023, 9 months 4 days ago
  • Operating system: Linux
  • PHP: 8.3.10 (Show info) [2024-09-30 19:05:27]
  • MySQL: 10.6.16-MariaDB [2024-09-30 19:05:27]
  • Graphics Library: ImageMagick 7.1.1-32
  • Cache size 1183.77 Mo   calculated 2 months ago Refresh

Activated plugin list

(all in the latest version)

  • Admin Tools
  • Batch Downloader
  • Community
  • Language Switch
  • LocalFiles Editor
  • Offset Creation Date
  • OpenStreetMap
  • Read Metadata
  • Rotate Image
  • ShareAlbum
  • Tag Groups
  • User Collections
  • VideoJS
My observation is different. The **Creation Date** is also set to hh:mm = 00:00, if the DateTimeOriginal is populated in EXIF and visible with the _Read metadata_ plugin: > ### EXIF Fields in 20240923-092607-0811.jpg > FileName = 20240930181824-f437b537.jpg > FileDateTime = 1727713104 > [...] > ExifVersion = 0231 > **DateTimeOriginal = 2024:09:23 09:26:07** > DateTimeDigitized = 2024:09:23 09:26:07 > [...] I see following behaviour: - If I upload my photos by means of the Digikam -> Piwigo Export function, the **Creation Date** includes the **correct hh:mm values**. - if I upload via the _DOMAINNAME_/admin.php?page=photos_add URL the time **is set to zero,** but in the Information link to the photo, the correct value of DateTimeOriginal appears under EXIF Metadata. - if I have a correct **Creation Date** and I apply the _Synchronize metadata_ Action in the Batch Manager, the time i**s set to zero** as well ### Environment - [Piwigo](https://piwigo.org/) 14.5.0 - Installed on 26 December 2023, 9 months 4 days ago - Operating system: Linux - PHP: 8.3.10 (Show info) [2024-09-30 19:05:27] - MySQL: 10.6.16-MariaDB [2024-09-30 19:05:27] - Graphics Library: ImageMagick 7.1.1-32 - Cache size 1183.77 Mo   calculated 2 months ago Refresh ### Activated plugin list (all in the latest version) - Admin Tools - Batch Downloader - Community - Language Switch - LocalFiles Editor - Offset Creation Date - OpenStreetMap - Read Metadata - Rotate Image - ShareAlbum - Tag Groups - User Collections - VideoJS <!-- github-comment-id:2383739908 -->
Author
Owner

I did some reading in the sources of functions_metadata.php and saw that based on the config file settings, the Creation Date among other data is derived from either EXIF or IPTC.
If in config.inc.php is set both

$conf['use_iptc'] = true;
$conf['use_exif'] = true;

IPTC obviously is prefered.
After I set

$conf['use_iptc'] = false;

the Creation Date included the correct values for hh:mm after the Synchronize metadata Action in the Batch Manager.

Also the upload via the DOMAINNAME/admin.php?page=photos_add URL is now taking over the hh:mm values.

Solution 1

  • If EXIF is required, do not set $conf['use_iptc'] = true; in config.inc.php.

Maybe it makes sense, to add a warning to the EXIF section in config.inc.php

Solution 2

remove the line

'date_creation' => '2#055',

from config.inc.php but leave $conf['use_iptc'] = true;

This also works and has the advantage that other parameters still can be derived from IPTC

I did some reading in the sources of [functions_metadata.php](https://github.com/Piwigo/Piwigo/blob/b0a5c404e7a8cee8f369e62044cc153d72509f06/admin/include/functions_metadata.php#L34) and saw that based on the config file settings, the **Creation Date** among other data is derived from either EXIF or IPTC. If in **config.inc.php** is set both > $conf['use_iptc'] = true; > $conf['use_exif'] = true; IPTC obviously is prefered. After I set > **$conf['use_iptc'] = false;** the Creation Date included the correct values for hh:mm after the _Synchronize metadata_ Action in the Batch Manager. Also the upload via the _DOMAINNAME_/admin.php?page=photos_add URL is now taking over the hh:mm values. ### Solution 1 - If EXIF is required, **do not set $conf['use_iptc'] = true;** in config.inc.php. Maybe it makes sense, to add a warning to the EXIF section in config.inc.php ### Solution 2 remove the line > 'date_creation' => '2#055', from config.inc.php but leave **$conf['use_iptc'] = true;** This also works and has the advantage that other parameters still can be derived from IPTC <!-- github-comment-id:2383880048 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#860