You are here

protected function Exif::getEntry 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::getEntry()

Returns a PelEntry.

Parameters

\lsolesen\pel\PelTiff $tiff: A PelTiff object.

int $ifd_tag: The IFD EXIF integer identifier.

int $key_tag: The TAG EXIF integer identifier.

Return value

\lsolesen\pel\PelEntry The PelEntry for the specified IFD and TAG.

1 call to Exif::getEntry()
Exif::doGetMetadataFromFile in file_mdm_exif/src/Plugin/FileMetadata/Exif.php
Gets file metadata from the file at URI/local path.

File

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

Class

Exif
FileMetadata plugin for EXIF.

Namespace

Drupal\file_mdm_exif\Plugin\FileMetadata

Code

protected function getEntry(PelTiff $tiff, $ifd_tag, $key_tag) {
  $ifd = $tiff
    ->getIfd();
  switch ($ifd_tag) {
    case PelIfd::IFD0:
      return $ifd
        ->getEntry($key_tag);
    case PelIfd::IFD1:
      $ifd1 = $ifd
        ->getNextIfd();
      if (!$ifd1) {
        return NULL;
      }
      return $ifd1
        ->getEntry($key_tag);
    case PelIfd::EXIF:
      $exif = $ifd
        ->getSubIfd(PelIfd::EXIF);
      if (!$exif) {
        return NULL;
      }
      return $exif
        ->getEntry($key_tag);
    case PelIfd::INTEROPERABILITY:
      $exif = $ifd
        ->getSubIfd(PelIfd::EXIF);
      if (!$exif) {
        return NULL;
      }
      $interop = $exif
        ->getSubIfd(PelIfd::INTEROPERABILITY);
      if (!$interop) {
        return NULL;
      }
      return $interop
        ->getEntry($key_tag);
    case PelIfd::GPS:
      $gps = $ifd
        ->getSubIfd(PelIfd::GPS);
      if (!$gps) {
        return NULL;
      }
      return $gps
        ->getEntry($key_tag);
  }
}