Piwigo exif / iptc metadata
Not all metadata imported to Piwigo
By default Piwigo does not use all metadata during import to build up the internal database. This is a problem as the Kipi Plugin does not set all metadata from the outside. Below you see the default settings from include/config_default.inc.php
.
$conf['show_iptc'] = false;
$conf['show_iptc_mapping'] = array(
'iptc_keywords' => '2#025',
'iptc_caption_writer' => '2#122',
'iptc_byline_title' => '2#085',
'iptc_caption' => '2#120'
);
$conf['use_iptc'] = false;
$conf['use_iptc_mapping'] = array(
'keywords' => '2#025',
'date_creation' => '2#055',
'author' => '2#122',
'name' => '2#005',
'comment' => '2#120'
);
$conf['show_exif'] = true;
$conf['show_exif_fields'] = array(
'Make',
'Model',
'DateTimeOriginal',
'COMPUTED;ApertureFNumber'
);
$conf['use_exif'] = true;
$conf['use_exif_mapping'] = array(
'date_creation' => 'DateTimeOriginal'
);
You see that the default mappings of the metadata fields are ok but the iptc metadata are disabled by default. The solution is to enable this metadata processing. The following steps show how to do this.
Getting a sample of metadata
To check if your images have all required metadata, you can upload a file with the name “sample.jpg” into to <rootfolder>/tools/sample.jpg
. Next, use your browser to visit http://<your-gallery-url>/tools/metadata.php. The output of this page should look similar to the data below. I just truncated some of the information to make it more readable.
Informations are read from sample.jpg
IPTC Fields in sample.jpg
1#090 = %G
2#010 = 0
2#025 = Flughafen Zürich
2#055 = 20180128
2#060 = 111942+0000
2#062 = 20180128
2#065 = Kipi-plugins
2#070 = 5.9.0
2#080 = PHILIPP HAEFELFINGER
2#116 = ALL RIGHTS RESERVED
EXIF Fields in sample.jpg
Array
(
[FileName] => sample.jpg
[FileDateTime] => 1524605190
[FileSize] => 5465263
[FileType] => 2
[MimeType] => image/jpeg
[SectionsFound] => ANY_TAG, IFD0, EXIF, MAKERNOTE
[COMPUTED] => Array
(
[html] => width="3467" height="5195"
[Height] => 5195
[Width] => 3467
[IsColor] => 1
[ByteOrderMotorola] => 0
[ApertureFNumber] => f/9.0
[Copyright] => ALL RIGHTS RESERVED
)
...
[FocalLength] => 121/1
)
With this information I can check the mapping from the default configuration file and set the parameters to enable the handling of the missing metadata.
Apply the configuration
To configure this, we have to add the following code to the local/config/config.inc.php
using your favorite editor or install the LocalFiles editor and do it from the Piwigo admin page. I did the following changes:
- Added more exif information to the metadata view part
- The IPTC metadata are now visible and may be reviewed
- the IPTC keywords are used as tags during import and synchronization
<?php
$conf['show_exif_fields'] = array(
'Make',
'Model',
'DateTimeOriginal',
'COMPUTED;ApertureFNumber',
'ExposureTime',
'ISOSpeedRatings'
);
$conf['show_iptc'] = true;
$conf['use_iptc'] = true;
?>
Just resync your metadata and the tags will be imported if they are present so far or upload images with filled metadata.
“LocalFiles Editor” Plugin
As Piwigo can be extended by a large number of plugins, there is one that makes customization of the local configuration really easy. The plugin is called “LocalFiles Editor” and can be installed from the plugin administration page.
This local/config/config.inc.php file will be created by the editor if it does not exist. And there may all custom settings of the local config files be managed by the user without using any remote shell access or ftp uploads.