Skip to content

Commit

Permalink
Exif reader: avoid converting stream to string to stream (#862)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlocati authored Jul 30, 2024
1 parent 3acdfa6 commit ce4748a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Image/Metadata/AbstractMetadataReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ abstract protected function extractFromFile($file);
/**
* Extracts metadata from raw data.
*
* @param $data
* @param string $data
*
* @return array An associative array of metadata
*/
Expand All @@ -109,7 +109,7 @@ abstract protected function extractFromData($data);
/**
* Extracts metadata from a stream.
*
* @param $resource
* @param resource $resource
*
* @return array An associative array of metadata
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Image/Metadata/ExifMetadataReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ protected function extractFromData($data)
*/
protected function extractFromStream($resource)
{
return $this->doReadData(stream_get_contents($resource));
return PHP_VERSION_ID < 70200 ? $this->doReadData(stream_get_contents($resource)) : $this->extract($resource);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Image/Metadata/MetadataReaderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function readFile($file);
* Reads metadata from a binary string.
*
* @param string $data the binary string to read
* @param resource $originalResource an optional resource to gather stream metadata
* @param resource|null $originalResource an optional resource to gather stream metadata
*
* @return \Imagine\Image\Metadata\MetadataBag
*/
Expand Down

0 comments on commit ce4748a

Please sign in to comment.