Skip to content

Commit

Permalink
try to fix the exif_read_data issue
Browse files Browse the repository at this point in the history
Signed-off-by: Simon L <[email protected]>
  • Loading branch information
szaimen committed Jan 28, 2023
1 parent 4ae17a0 commit 3fb06ba
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/private/Metadata/Provider/ExifProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ public function execute(File $file): array {
// But I don't understand why 1 as a special meaning.
// Revert right after reading the exif data.
$oldBufferSize = stream_set_chunk_size($fileDescriptor, 1);
$data = exif_read_data($fileDescriptor, 'ANY_TAG', true);
if (is_resource($fileDescriptor) || is_string($fileDescriptor)) {
$data = exif_read_data($fileDescriptor, 'ANY_TAG', true);
}
stream_set_chunk_size($fileDescriptor, $oldBufferSize);
} catch (\Exception $ex) {
$this->logger->warning("Couldn't extract metadata for ".$file->getId(), ['exception' => $ex]);
$this->logger->info("Couldn't extract metadata for ".$file->getId(), ['exception' => $ex]);
}

$size = new FileMetadata();
Expand Down

0 comments on commit 3fb06ba

Please sign in to comment.