You are here

protected function ImagemagickIdentify::doGetMetadata in ImageMagick 8.3

Same name and namespace in other branches
  1. 8.2 src/Plugin/FileMetadata/ImagemagickIdentify.php \Drupal\imagemagick\Plugin\FileMetadata\ImagemagickIdentify::doGetMetadata()

File

src/Plugin/FileMetadata/ImagemagickIdentify.php, line 140

Class

ImagemagickIdentify
FileMetadata plugin for ImageMagick's identify results.

Namespace

Drupal\imagemagick\Plugin\FileMetadata

Code

protected function doGetMetadata($key = NULL) {
  if ($key === NULL) {
    return $this->metadata;
  }
  else {
    $this
      ->validateKey($key, __FUNCTION__);
    switch ($key) {
      case 'source_local_path':
        return isset($this->metadata['source_local_path']) ? $this->metadata['source_local_path'] : NULL;
      case 'frames_count':
        return isset($this->metadata['frames']) ? count($this->metadata['frames']) : 0;
      default:
        return isset($this->metadata['frames'][0][$key]) ? $this->metadata['frames'][0][$key] : NULL;
    }
  }
}