Skip to content
Closed
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
14 changes: 13 additions & 1 deletion lib/private/legacy/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,19 @@ public function load($imageRef) {
public function loadFromFileHandle($handle) {
$contents = \stream_get_contents($handle);
if ($this->loadFromData($contents)) {
$this->loadExifData($handle);
// The loadExifData function has problems using the $handle resource
// so the exif data isn't loaded with some files (checked with jpg).
// Note that this error doesn't happen with all the (jpg) files, but
// some of them.
// As workaround, we write the contents in a temporary stream
// and load the exif data from there
$ff = \fopen('php://temp', 'w+');
\fwrite($ff, $contents);
// no need to seek to the initial position because the underlying
// exif_read_data is expected to handle it on its own. It works
// without seeking
$this->loadExifData($ff);
\fclose($ff);
return $this->resource;
}
return false;
Expand Down