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);
}