lib/PHPExif/Adapter/Exiftool.php
public function getExifFromFile($file)
    {
        $encoding = '';
        if (!empty($this->encoding)) {
            $encoding = '-charset ';
            foreach ($this->encoding as $key => $value) {
                $encoding .= escapeshellarg($key).'='.escapeshellarg($value);
            }
        }
        $result = $this->getCliOutput(
            sprintf(
                '%1$s%3$s -j -a -G1 %5$s -c %4$s %2$s',
                $this->getToolPath(),
                escapeshellarg($file),
                $this->numeric ? ' -n' : '',
                escapeshellarg('%d deg %d\' %.4f"'),
                $encoding
            )
        );

        if (!mb_check_encoding($result, "utf-8")) {
            $result = utf8_encode($result);
        }
        $data = json_decode($result, true);
        if (!is_array($data)) {
            throw new RuntimeException(
                'Could not decode exiftool output'
            );
        }

        // map the data:
        $mapper = $this->getMapper();
        $mapper->setNumeric($this->numeric);
        $mappedData = $mapper->mapRawData(reset($data));

        // hydrate a new Exif object
        $exif = new Exif();
        $hydrator = $this->getHydrator();
        $hydrator->hydrate($exif, $mappedData);
        $exif->setRawData(reset($data));

        return $exif;
    }
public function getExifFromFile($file)
    {
        $encoding = '';
        if (!empty($this->encoding)) {
            $encoding = '-charset ';
            foreach ($this->encoding as $key => $value) {
                $encoding .= escapeshellarg($key).'='.escapeshellarg($value);
            }
        }
        $result = $this->getCliOutput(
            sprintf(
                '%1$s%3$s -j -a -G1 %5$s -c %4$s %2$s',
                $this->getToolPath(),
                escapeshellarg($file),
                $this->numeric ? ' -n' : '',
                escapeshellarg('%d deg %d\' %.4f"'),
                $encoding
            )
        );

        if (!mb_check_encoding($result, "utf-8")) {
            $result = utf8_encode($result);
        }
        $data = json_decode($result, true);
        if (!is_array($data)) {
            throw new RuntimeException(
                'Could not decode exiftool output'
            );
        }

        // map the data:
        $mapper = $this->getMapper();
        $mapper->setNumeric($this->numeric);
        $mappedData = $mapper->mapRawData(reset($data));

        // hydrate a new Exif object
        $exif = new Exif();
        $hydrator = $this->getHydrator();
        $hydrator->hydrate($exif, $mappedData);
        $exif->setRawData(reset($data));

        return $exif;
    }
Reads & parses the EXIF data from given file

@param string $file
@return \PHPExif\Exif Instance of Exif object with data
@throws \RuntimeException If the EXIF data could not be read