You are here

protected function Exif::setIfdEntries in File metadata manager 8

Same name and namespace in other branches
  1. 8.2 file_mdm_exif/src/Plugin/FileMetadata/Exif.php \Drupal\file_mdm_exif\Plugin\FileMetadata\Exif::setIfdEntries()

Adds or changes entries for an IFD.

Parameters

lsolesen\pel\PelIfd $ifd: A PelIfd object.

lsolesen\pel\PelEntry[] $entries: An array of PelEntry objects.

Return value

bool TRUE if entries were added/changed successfully, FALSE otherwise.

1 call to Exif::setIfdEntries()
Exif::doSaveMetadataToFile in file_mdm_exif/src/Plugin/FileMetadata/Exif.php
Saves metadata to file at URI.

File

file_mdm_exif/src/Plugin/FileMetadata/Exif.php, line 324

Class

Exif
FileMetadata plugin for EXIF.

Namespace

Drupal\file_mdm_exif\Plugin\FileMetadata

Code

protected function setIfdEntries(PelIfd $ifd, array $entries) {
  foreach ($entries as $tag => $input_entry) {
    if ($c = $ifd
      ->getEntry($tag)) {
      if ($input_entry === 'deleted') {
        unset($ifd[$tag]);
      }
      else {
        $c
          ->setValue($input_entry
          ->getValue());
      }
    }
    else {
      if ($input_entry !== 'deleted') {
        $ifd
          ->addEntry($input_entry);
      }
    }
  }
  return TRUE;
}