Same name in other branches
  1. 7.x-1.x SimpleExiftoolFacade.php \Drupal\exif\SimpleExifToolFacade::readAllInformation()
  2. 8.x-1.x src/SimpleExifToolFacade.php \Drupal\exif\SimpleExifToolFacade::readAllInformation()

Retrieve all metadata using exifTool.

Paramètres

string $file: Image to scan.

bool $enable_sections: Extract sections or not.

bool $enable_markerNote: Extract marker notes or not (for now, always FALSE)

bool $enable_non_supported_tags: Extract non supported tags or not (for now, always FALSE)

Return value

array all metadata usable by this module.

1 call to SimpleExifToolFacade::readAllInformation()
SimpleExifToolFacade::readMetadataTags dans src/SimpleExifToolFacade.php
Retrieve all metadata from a file.

Fichier

src/SimpleExifToolFacade.php, line 104

Classe

SimpleExifToolFacade
Class SimpleExifToolFacade.

Namespace

Drupal\exif

Code

private function readAllInformation($file, $enable_sections = TRUE, $enable_markerNote = FALSE, $enable_non_supported_tags = FALSE) {
    $jsonAsString = $this->runTool($file, $enable_sections, $enable_markerNote, $enable_non_supported_tags);
    $json = json_decode($jsonAsString, TRUE);
    $errorCode = json_last_error();
    if ($errorCode == JSON_ERROR_NONE) {
        return $this->toLowerJsonResult($json[0]);
    }
    else {
        $errorMessage = "";
        switch ($errorCode) {
            case JSON_ERROR_DEPTH:
                $errorMessage = 'Maximum stack depth exceeded';
                break;
            case JSON_ERROR_STATE_MISMATCH:
                $errorMessage = 'Underflow or the modes mismatch';
                break;
            case JSON_ERROR_CTRL_CHAR:
                $errorMessage = 'Unexpected control character found';
                break;
            case JSON_ERROR_SYNTAX:
                $errorMessage = 'Syntax error, malformed JSON';
                break;
            case JSON_ERROR_UTF8:
                $errorMessage = 'Malformed UTF-8 characters, possibly incorrectly encoded';
                break;
            default:
                $errorMessage = 'Unknown error';
                break;
        }
        // Logs a notice.
        \Drupal::logger('exif')->notice($this->t('@error', [
            '@error' => $errorMessage,
        ]));
        return [];
    }
}