From 28aa3f9fd361391f80ec814f95f4ae7680bf8e91 Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Mon, 8 Jul 2024 16:48:19 +0200 Subject: [PATCH] add page images for cafeyn --- epub.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/epub.php b/epub.php index 2c89575..59c8c9b 100644 --- a/epub.php +++ b/epub.php @@ -131,6 +131,7 @@ $epub->title = $pubname . ' ' . $date ; $list = (array)$publication->articles; + $page = 1; foreach ($list as $entry) { $articleurl = str_replace('material', 'article/' . $entry->hash . '.json', $url); @@ -139,7 +140,8 @@ $content = '

' . $article->title . '

'; $content .= '' . $article->abstract . ''; - + $content .= '
Page ' . $article->page . '
'; + if (count($article->rubrics)) { $content .= '
Rubriques: ' . implode(',', $article->rubrics) . '
'; @@ -171,10 +173,22 @@ } } - /*if ($article->imageUrl) + while ($article->page >= $page) { - $epub->AddPage('', false, 'Page ' . $article->page, true); - }*/ + $path = $publication->pages[$page - 1]->tn; + $path = str_replace('material', $path, $url); + $path = str_replace('api.', 'content.', $path); + if ($page == 1) + { + // cover + $epub->AddImage($path, 'image/jpeg', true); + } + else + { + $epub->AddPage('', false, 'Page ' . $page, true); + } + $page++; + } $epub->AddPage($content, false, $article->title); }