/** * Generates a metadatas-free version of the file in the temporary directory * * @return string the path file to the temporary file */ private function getTemporaryEmptyFile() { $tmpFile = tempnam(sys_get_temp_dir(), 'hash'); unlink($tmpFile); try { $this->writer->reset(); $this->writer->erase(true); $this->writer->write($this->file->getPathname(), new MetadataBag(), $tmpFile); } catch (PHPExiftoolExceptionInterface $e) { /** * Some files can not be written by exiftool */ copy($this->file->getPathname(), $tmpFile); } $this->temporaryFiles[] = $tmpFile; return $tmpFile; }