From dbc8777c4332c23a8bb8155cd551ff09cfd30549 Mon Sep 17 00:00:00 2001 From: JeongHean Kim Date: Thu, 25 Jul 2019 15:00:23 +0900 Subject: [PATCH] Fix failed stat when using setEmbedImagesin HTML writer Fixes #1084 Closes #1085 --- src/PhpSpreadsheet/Writer/Html.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/PhpSpreadsheet/Writer/Html.php b/src/PhpSpreadsheet/Writer/Html.php index 8cd026d3..6ab08a96 100644 --- a/src/PhpSpreadsheet/Writer/Html.php +++ b/src/PhpSpreadsheet/Writer/Html.php @@ -643,7 +643,10 @@ class Html extends BaseWriter } else { $imageDetails = getimagesize($filename); if ($fp = fopen($filename, 'rb', 0)) { - $picture = fread($fp, filesize($filename)); + $picture = ''; + while (!feof($fp)) { + $picture .= fread($fp, 1024); + } fclose($fp); // base64 encode the binary data, then break it // into chunks according to RFC 2045 semantics