Metadata read/write mapping

ResourceSpace is able to map between embedded metadata stored in your original files and the metadata fields in ResourceSpace itself. This synchronisation can be two way, so that imported metadata can be automatically extracted into a configured field, but also that metadata added to the resource after import is written back to the file at download.

Mapping metadata when using the ExifTool utility

ResourceSpace makes use of the open source ExifTool utility to read and write metadata. This is extremely flexible and any metadata present in a file can be mapped to ResourceSpace fields. Many different profiles are supported in addition to Exif, including XMP, IPTC, GPS, JFIF, GeoTIFF, ICC Profile, Photoshop IRB, FlashPix, AFCP and ID3.

You must have ExifTool (a command-line interface to a PERL library) installed and enabled (the path must be specified) in config.php or auto-detected during the setup routine.

In order to map an IPTC/Exif/XMP tag name to a ResourceSpace field, you can enter the ExifTool-supported tag name(s) in the "Exiftool field" box in the metadata field settings for that field.

You can specify the namespace that you want to extract the tag from. This is useful when there are overlapping tag names with different values (e.g. XMP and IPTC both include a 'Keywords' tag). To specify a namespace for the tag simply prefix the tag name with the namespace in capitals and a colon e.g. 'XMP:Keywords' or 'IPTC:ImageDescription'

Here are some example mappings. Your default installation will probably have these and more already set up.

RS Field Exiftool_field Tags
Title Title
Keywords - Other IPTC:Keywords,Subject,XMP:Keywords
Caption IPTC:Caption-Abstract,IPTC:ImageDescription,XMP:Description
Country IPTC:Country-PrimaryLocationName,XMP:Country
Named Persons XMP:PersonInImage,XMP:People
Credit IPTC:Credit,XMP:Credit
Camera Make/Model Model
Notes JobID

Please refer to the ExifTool documentation for further information on tag names. Exiftool fully supports read/writing of several filetypes including JPG, GIF, PNG, TIF, EPS, PDF. It can also read data from other filetypes that are not write-supported.

The following link provides useful documentation of the command-line capabilities

Run the following command on the command line for a (long) list of writable fields. Any of those names could be used in the exiftool_field in RS to develop your ideal read/write mapping.

exiftool -listw

Run the following command to see a report of all the existing metadata in an image, including the namespace.

exiftool -a -G1 <FILENAME>


exiftool  -a -G1 ~/Photos/DSC_6071.JPG

If you have files with metadata in them and want ResourceSpace to extract that information, you can use the metadata report and this output to construct the appropriate mappings

Remember that some fields may not be available for a particular filetype, for example JobID will not write to a PDF file. If you need "Notes" to be written to PDF files, you will have to find a PDF-writable field in addition to JobID. The reason for using multiple fields is that certain programs look for information in a specific place. For example if Photoshop gets the caption from Caption-Abstract and another program you use gets it from ImageDescription, you need to have your ResourceSpace caption in both. It may take some experimentation to get the combination that best suits your workflow.

Of course you can also create your own custom fields and mappings. One such use may be to embed a weblink in the metadata of your images. You simply create an ResourceSpace field, for example "URL" and in the Exiftool_field you enter "WebStatement", a field which can be found in ExifTool's list of writeable fields and is appropriate for data of that type.

Read-only metadata fields

ResourceSpace can have certain metadata fields set as read-only. This will determine whether the field should be written back to the files on download.

This is determined under Admin > System > Manage metadata fields area. A Super Administrator will enable this for all fields that should be read-only by selecting the option Read-only metadata field (ie. will not write back on Download).

Please note that this option will only affect embedded metadata, not to be confused with CSV exported metadata. Fields included in a CSV export are determined using the field option 'Include in CSV export' and will be included in the CSV sheet irrespective of user access or exif read/write settings.

Example configuration and expected behaviour

$exiftool_write                = true;
$force_exiftool_write_metadata = true;
$exiftool_write_option         = true;
$exiftool_remove_existing      = true;

With the above configuration ResourceSpace will force the writing on download of the values ascribed to the resource within ResourceSpace. However for fields set as read-only no value will be embedded on download.

Please note the above configuration is using the remove_existing option. If this is set to false the original field value will be embedded in the file on download, rather than any value added to the resource by edits within ResourceSpace.

Mapping Exif / IPTC without Exiftool

If you have not installed Exiftool, ResourceSpace still supports the reading of some basic EXIF fields and all IPTC fields when resources are uploaded. For anything other than the most basic metadata support it is best to use ExifTool as described above.

Without ExifTool, ResourceSpace will not write altered metadata back to files on download.

Exif fields are mapped using the $exif_* settings in include/config.php.

IPTC fields are mapped using the 'IPTC Equiv.' option on each field in System Setup. The codes you need are as follows:

IPTC Equiv. value Metadata field extracted
2#120 Caption
2#025 Keywords
2#055 Creation Date
2#040 Special Instructions
2#085 Credit Byline Title
2#101 Country
2#105 Headline
2#110 Source
2#115 Photo Source
2#120 Caption
2#090 City
2#095 State