diff options
Diffstat (limited to 'api/export.php')
| -rw-r--r-- | api/export.php | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/api/export.php b/api/export.php index 77e36a2..625283e 100644 --- a/api/export.php +++ b/api/export.php @@ -1,6 +1,6 @@ <?php -require_once '../vendor/autoload.php'; -require_once '../src/data.php'; +require_once '%PWD%vendor/autoload.php'; +require_once '%PWD%src/data.php'; [$data, $count] = get_data(); @@ -22,15 +22,17 @@ $row = 2; foreach ($data as $d) { $active_sheet->setCellValue('A' . $row, $d["name"]); - $drawing = new Drawing(); - $drawing->setName($d["name"]); - $drawing->setPath("../imgs/" . $d["thumbnail"]); - $drawing->setHeight(200); - - $comment = $active_sheet->getComment('A' . $row); - $comment->setBackgroundImage($drawing); - $comment->setSizeAsBackgroundImage(); + $path = "%PWD%imgs/" . $d["thumbnail"]; + if(file_exists($path)) { + $drawing = new Drawing(); + $drawing->setName($d["name"]); + $drawing->setPath($path); + $drawing->setHeight(200); + $comment = $active_sheet->getComment('A' . $row); + $comment->setBackgroundImage($drawing); + $comment->setSizeAsBackgroundImage(); + } $active_sheet->setCellValue('B' . $row, $d["author"]); $active_sheet->setCellValue('C' . $row, $d["magazine"]); |
