Classes/Utility/FAL.php
protected static function updateIndex(\TYPO3\CMS\Core\Resource\File $file = null, $width, $height, array $metadata = [])
    {
        if (count($metadata) > 0) {
            /** @var \TYPO3\CMS\Core\Resource\Index\MetaDataRepository $metadataRepository */
            $metadataRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Index\MetaDataRepository::class);
            // Will take care of creating the record if it does not exist yet
            $currentMetadata = $metadataRepository->findByFile($file);

            $newMetadata = [];
            // Pre-populate with metadata coming from external extractors
            foreach ($currentMetadata as $key => $value) {
                if (!empty($metadata[$key])) {
                    // Known issue with "creator_tool" having a software version sometimes
                    if ($key === 'creator_tool' && MathUtility::canBeInterpretedAsFloat($metadata[$key])) {
                        continue;
                    }
                    $newMetadata[$key] = $metadata[$key];
                }
            }
            // Width and height are always wrong since we resized the image
            unset($newMetadata['width']);
            unset($newMetadata['height']);
            // We deal with resized images so unit is always pixels
            $newMetadata['unit'] = 'px';

            // Mapping for the built-in PHP-based metadata extractor
            $mapping = [
                'color_space' => 'ColorSpace',
                'content_creation_date' => 'DateTimeOriginal',
                'creator' => 'IPTCCreator|Company',
                'creator_tool' => 'Model|Make|Software',
                'description' => 'ImageDescription',
                'keywords' => 'IPTCKeywords',
                'latitude' => 'GPSLatitudeDecimal',
                'longitude' => 'GPSLongitudeDecimal',
                'location_city' => 'IPTCCity',
                'location_country' => 'IPTCCountry',
                'location_region' => 'IPTCRegion',
                'note' => 'IPTCLocation',
                'publisher' => 'IPTCCredit',
                'source' => 'IPTCSource',
                'title' => 'IPTCTitle',
            ];
            foreach ($mapping as $falKey => $metadataKeyMapping) {
                if (!empty($newMetadata[$falKey])) {
                    // We already have a known-to-be-valid metadata for this FAL property
                    continue;
                }
                $metatadaKeys = explode('|', $metadataKeyMapping);
                foreach ($metatadaKeys as $metadataKey) {
                    $value = null;
                    if (isset($metadata[$metadataKey])) {
                        $value = trim($metadata[$metadataKey]);
                        if (ord($value) === 1) $value = null;
                        switch ($metadataKey) {
                            case 'ColorSpace':
                                if ($value == 1) {
                                    $value = 'RGB';
                                } else {
                                    // Unknown
                                    $value = null;
                                }
                                break;
                            case 'DateTimeOriginal':
                                $value = strtotime($value);
                                break;
                        }
                    }
                    if (!empty($value)) {
                        $newMetadata[$falKey] = $value;
                        break;
                    }
                }
            }
            $metadataRepository->update($file->getUid(), $newMetadata);
        }
    }
protected static function updateIndex(\TYPO3\CMS\Core\Resource\File $file = null, $width, $height, array $metadata = [])
    {
        if (count($metadata) > 0) {
            /** @var \TYPO3\CMS\Core\Resource\Index\MetaDataRepository $metadataRepository */
            $metadataRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Index\MetaDataRepository::class);
            // Will take care of creating the record if it does not exist yet
            $currentMetadata = $metadataRepository->findByFile($file);

            $newMetadata = [];
            // Pre-populate with metadata coming from external extractors
            foreach ($currentMetadata as $key => $value) {
                if (!empty($metadata[$key])) {
                    // Known issue with "creator_tool" having a software version sometimes
                    if ($key === 'creator_tool' && MathUtility::canBeInterpretedAsFloat($metadata[$key])) {
                        continue;
                    }
                    $newMetadata[$key] = $metadata[$key];
                }
            }
            // Width and height are always wrong since we resized the image
            unset($newMetadata['width']);
            unset($newMetadata['height']);
            // We deal with resized images so unit is always pixels
            $newMetadata['unit'] = 'px';

            // Mapping for the built-in PHP-based metadata extractor
            $mapping = [
                'color_space' => 'ColorSpace',
                'content_creation_date' => 'DateTimeOriginal',
                'creator' => 'IPTCCreator|Company',
                'creator_tool' => 'Model|Make|Software',
                'description' => 'ImageDescription',
                'keywords' => 'IPTCKeywords',
                'latitude' => 'GPSLatitudeDecimal',
                'longitude' => 'GPSLongitudeDecimal',
                'location_city' => 'IPTCCity',
                'location_country' => 'IPTCCountry',
                'location_region' => 'IPTCRegion',
                'note' => 'IPTCLocation',
                'publisher' => 'IPTCCredit',
                'source' => 'IPTCSource',
                'title' => 'IPTCTitle',
            ];
            foreach ($mapping as $falKey => $metadataKeyMapping) {
                if (!empty($newMetadata[$falKey])) {
                    // We already have a known-to-be-valid metadata for this FAL property
                    continue;
                }
                $metatadaKeys = explode('|', $metadataKeyMapping);
                foreach ($metatadaKeys as $metadataKey) {
                    $value = null;
                    if (isset($metadata[$metadataKey])) {
                        $value = trim($metadata[$metadataKey]);
                        if (ord($value) === 1) $value = null;
                        switch ($metadataKey) {
                            case 'ColorSpace':
                                if ($value == 1) {
                                    $value = 'RGB';
                                } else {
                                    // Unknown
                                    $value = null;
                                }
                                break;
                            case 'DateTimeOriginal':
                                $value = strtotime($value);
                                break;
                        }
                    }
                    if (!empty($value)) {
                        $newMetadata[$falKey] = $value;
                        break;
                    }
                }
            }
            $metadataRepository->update($file->getUid(), $newMetadata);
        }
    }
Updates the index entry for a given file.

@param \TYPO3\CMS\Core\Resource\File $file
@param integer $width
@param integer $height
@param array $metadata EXIF metadata
@return void