Skip to content

Commit

Permalink
Require GD for saving images in xls
Browse files Browse the repository at this point in the history
GD is implicitly required for saving images anyway, this exception when
it's not loaded simply gives more information on what to do if the
execution flow reaches a places that depends on a function from GD.
  • Loading branch information
kamazee authored and Mirocow committed Jan 16, 2017
1 parent 2f85ff8 commit fc2ee3e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/PhpSpreadsheet/Writer/Xls.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit fc2ee3e

Please sign in to comment.