add page images for cafeyn

This commit is contained in:
quenousimporte 2024-07-08 16:48:19 +02:00
parent d22c73b14f
commit 28aa3f9fd3
1 changed files with 18 additions and 4 deletions

View File

@ -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 = '<h1>' . $article->title . '</h1>';
$content .= '<b>' . $article->abstract . '</b>';
$content .= '<div>Page ' . $article->page . '</div>';
if (count($article->rubrics))
{
$content .= '<div>Rubriques: ' . implode(',', $article->rubrics) . '</div>';
@ -171,10 +173,22 @@
}
}
/*if ($article->imageUrl)
while ($article->page >= $page)
{
$epub->AddPage('<img style="width: 100%" src="' . $article->imageUrl . '">', 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('<img style="width: 100%" src="' . $path . '">', false, 'Page ' . $page, true);
}
$page++;
}
$epub->AddPage($content, false, $article->title);
}