You are here

function SimpleExifToolFacade::runTool in Exif 7

Same name and namespace in other branches
  1. 8.2 src/SimpleExifToolFacade.php \Drupal\exif\SimpleExifToolFacade::runTool()
  2. 8 src/SimpleExifToolFacade.php \Drupal\exif\SimpleExifToolFacade::runTool()
1 call to SimpleExifToolFacade::runTool()
SimpleExifToolFacade::readAllInformation in ./SimpleExiftoolFacade.php

File

./SimpleExiftoolFacade.php, line 95

Class

SimpleExifToolFacade

Namespace

Drupal\exif

Code

function runTool($file, $enable_sections = true, $enable_markerNote = false, $enable_non_supported_tags = false) {
  $params = "";
  if ($enable_sections) {
    $params = "-g -struct ";
  }
  if ($enable_markerNote) {
    $params = $params . "-fast ";
  }
  else {
    $params = $params . "-fast2 ";
  }
  if ($enable_non_supported_tags) {
    $params = $params . " -u -U";
  }
  $commandline = "exiftool -E -n -json " . $params . "\"" . $file . "\"";
  $output = array();
  $returnCode = 0;
  exec($commandline, $output, $returnCode);

  //print_r($output);
  if ($returnCode != 0) {
    $output = "";
    watchdog('exif', 'Exiftool returns an error. Can not extract metadata from file !file', array(
      '!file' => $file,
    ), WATCHDOG_WARNING);
  }
  $info = implode("\n", $output);
  return $info;
}