From 96be781f7ed912edfac65b7367c36bbf325fc781 Mon Sep 17 00:00:00 2001 From: Ramiro Araujo Date: Fri, 10 Apr 2015 17:04:16 -0300 Subject: [PATCH] rewind stream to read, but leave original pointer where it was --- src/Intervention/Image/AbstractDecoder.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Intervention/Image/AbstractDecoder.php b/src/Intervention/Image/AbstractDecoder.php index 714797ab..5eabd8ff 100644 --- a/src/Intervention/Image/AbstractDecoder.php +++ b/src/Intervention/Image/AbstractDecoder.php @@ -78,7 +78,11 @@ abstract class AbstractDecoder */ public function initFromStream($stream) { - if ($data = @stream_get_contents($stream)){ + $offset = ftell($stream); + rewind($stream); + $data = @stream_get_contents($stream); + fseek($stream, $offset); + if ($data) { return $this->initFromBinary($data); }