diff --git a/src/PhpSpreadsheet/Writer/Xls.php b/src/PhpSpreadsheet/Writer/Xls.php index 1ca8921188..d60a415cb7 100644 --- a/src/PhpSpreadsheet/Writer/Xls.php +++ b/src/PhpSpreadsheet/Writer/Xls.php @@ -454,6 +454,9 @@ private function buildWorkbookEscher() // the BSE's (all the images) foreach ($this->spreadsheet->getAllsheets() as $sheet) { foreach ($sheet->getDrawingCollection() as $drawing) { + if (!extension_loaded('gd')) { + throw new \RuntimeException('Saving images in xls requires gd extension'); + } if ($drawing instanceof \PhpOffice\PhpSpreadsheet\Worksheet\Drawing) { $filename = $drawing->getPath();