xanweb/c5-foundation

ConcreteCMS Foundation

v2.1.5 2024-09-27 08:48 UTC

README

Latest Version on Packagist Software License

Installation

Include library to your composer.json

composer require xanweb/c5-foundation

How to use Image Data Extractor

Data Extractor tries to use both IPTC and EXIF metadata to fill image information.

Register importer processor within application/config/app.php

return [
    /*
     * Importer processors
     */
    'import_processors' => [
        'xw.image.data_extractor' => \Xanweb\C5\Foundation\File\Import\Processor\DataExtractor::class,
    ],
];

You need then to map image information to properties or attributes.

Here is the list of available information keys:

  • image_title: title of the image
  • artist: artist name
  • author_title: author name
  • keywords
  • image_description
  • comments
  • copyright

The default mapping is like follows:

[
    'image_title' => 'title', // mapped to file title property
    'comments' => 'description', // mapped to file description property
    'keywords' => 'tags', // mapped to file tags property
]

To override the default mapping you need to add xanweb.php config file under /application/config.
Here is an example of possible mapping:

<?php

return [
    'file_manager' => [
        'images' => [
            'data_extractor' => [
                'image_title' => ['title', 'ak_alt'], // You can use multiple properties/attributes per field.
                'comments' => 'description',
                'keywords' => 'tags',
                'author_title' => 'ak_author', // Use 'ak_' prefix for attributes.
                'copyright' => 'ak_copyright',
            ]
        ],
    ],
];