Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exif reader: avoid converting stream to string to stream #862

Merged
merged 3 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading