protected function ExifTagMapper::getStringToTagMap in File metadata manager 8.2
Same name and namespace in other branches
- 8 file_mdm_exif/src/ExifTagMapper.php \Drupal\file_mdm_exif\ExifTagMapper::getStringToTagMap()
Returns the map of TAG strings to IFD/TAG integers.
Builds and caches the list as needed.
Return value
array An associative array where keys are TAG literals, and values a simple array of IFD/TAG integer identifiers.
File
- file_mdm_exif/
src/ ExifTagMapper.php, line 243
Class
- ExifTagMapper
- Provides a mapping service for EXIF ifds and tags.
Namespace
Drupal\file_mdm_exifCode
protected function getStringToTagMap() {
if (!$this->stringToTagMap) {
$cache_id = 'stringToTag';
if ($cache = $this
->getCache($cache_id)) {
$this->stringToTagMap = $cache->data;
}
else {
foreach ($this
->getSupportedIfdsMap() as $ifd) {
$ifd_obj = new PelIfd($ifd[1]);
$valid_tags = $ifd_obj
->getValidTags();
foreach ($valid_tags as $tag) {
$tag_name = strtolower(PelTag::getName($ifd[1], $tag));
if (!isset($this->stringToTagMap[$tag_name])) {
$this->stringToTagMap[$tag_name] = [
$ifd[1],
$tag,
];
}
}
}
$this
->setCache($cache_id, $this->stringToTagMap);
}
}
return $this->stringToTagMap;
}