diff options
| author | Maksymilian Jopek <maks@jopek.eu> | 2023-02-25 19:06:54 +0100 |
|---|---|---|
| committer | Maksymilian Jopek <maks@jopek.eu> | 2023-03-26 20:04:17 +0200 |
| commit | 19218d758d4fc0f8f5db5a97eb9dcfdb5086f844 (patch) | |
| tree | 9a5e956cd6561e7d1919e19e5d080c69017763c2 /api/export.php | |
| parent | 3df4ebc26d93afed16670e37edb26aa3b5a17317 (diff) | |
| download | mlos-19218d758d4fc0f8f5db5a97eb9dcfdb5086f844.tar.gz mlos-19218d758d4fc0f8f5db5a97eb9dcfdb5086f844.tar.zst mlos-19218d758d4fc0f8f5db5a97eb9dcfdb5086f844.zip | |
Remove path from repo
Add start script
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"]); |
