You are here

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

Returns the PEL file object for the image file.

Return value

\lsolesen\pel\PelJpeg|\lsolesen\pel\PelTiff A PEL file object.

2 calls to Exif::getFile()
Exif::doGetMetadataFromFile in file_mdm_exif/src/Plugin/FileMetadata/Exif.php
Gets file metadata from the file at URI/local path.
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 101

Class

Exif
FileMetadata plugin for EXIF.

Namespace

Drupal\file_mdm_exif\Plugin\FileMetadata

Code

protected function getFile() {
  if ($this->pelFile !== NULL) {
    return $this->pelFile;
  }
  else {
    switch ($this->mimeTypeGuesser
      ->guess($this
      ->getUri())) {
      case 'image/jpeg':
        $this->pelFile = new PelJpeg($this
          ->getLocalTempPath());
        return $this->pelFile !== NULL ? $this->pelFile : FALSE;
      case 'image/tiff':
        $this->pelFile = new PelTiff($this
          ->getLocalTempPath());
        return $this->pelFile !== NULL ? $this->pelFile : FALSE;
      default:
        return FALSE;
    }
  }
}