Same name and namespace in other branches
- 8.x-1.x src/SimpleExifToolFacade.php \Drupal\exif\SimpleExifToolFacade::runTool() 1 comment
- 8.x-2.x src/SimpleExifToolFacade.php \Drupal\exif\SimpleExifToolFacade::runTool() 1 comment
1 call to SimpleExifToolFacade::runTool()
File
-
./
SimpleExiftoolFacade.php, line 69
Class
- SimpleExifToolFacade
- Helper class to handle the whole data processing of EXIF with exiftool.
Namespace
Drupal\exifCode
public function runTool($file, $enable_sections = TRUE, $enable_markerNote = FALSE, $enable_non_supported_tags = FALSE) {
$params = ' -E -n -json ';
if ($enable_sections) {
$params .= '-g -struct ';
}
if ($enable_markerNote) {
$params .= '-fast ';
}
else {
$params .= '-fast2 ';
}
if ($enable_non_supported_tags) {
$params .= '-u -U ';
}
// Escape all of the arguments passed to the function.
// Note: If params is expanded so it is customizable, make sure that each
// piece is passed through escapeshellarg().
$commandline = escapeshellcmd('exiftool' . $params . escapeshellarg($file));
$output = array();
$returnCode = 0;
exec($commandline, $output, $returnCode);
if ($returnCode != 0) {
$output = "";
watchdog('exif', 'Exiftool returns an error. Can not extract metadata from file !file', array(
'!file' => $file,
), WATCHDOG_WARNING);
}
return implode("\n", $output);
}