Compare commits
No commits in common. "9a53ed1da377b3f13d4e40fe955f49074a2296ee" and "254d1fff483e8084f808deb0cc3d34bc10518e93" have entirely different histories.
9a53ed1da3
...
254d1fff48
30
epub.php
30
epub.php
|
@ -53,16 +53,6 @@
|
|||
return $temp_img_path;
|
||||
}
|
||||
|
||||
function inner_html($node)
|
||||
{
|
||||
$innerHTML = '';
|
||||
foreach ($node->childNodes as $childNode)
|
||||
{
|
||||
$innerHTML .= $childNode->ownerDocument->saveHTML($childNode);
|
||||
}
|
||||
return $innerHTML;
|
||||
}
|
||||
|
||||
date_default_timezone_set('Europe/Paris');
|
||||
$date = (new DateTime('today'))->format('Ymd');
|
||||
|
||||
|
@ -72,8 +62,6 @@
|
|||
// parameters hardcoded for now
|
||||
$includeimages = false;
|
||||
$includepages = true;
|
||||
$imagesonly = false;
|
||||
$imagesize = $imagesonly ? "XLARGE" : "MEDIUM";
|
||||
|
||||
$url = $_POST['lmurl'];
|
||||
|
||||
|
@ -124,17 +112,14 @@
|
|||
}))[0];
|
||||
$pageid = $pageobj->PublicationPageID;
|
||||
|
||||
$path = lm_download_image($url, 'Preview-' . $imagesize . '-', $pageid);
|
||||
$path = lm_download_image($url, 'Preview-MEDIUM-', $pageid);
|
||||
$epub->AddPage('<img style="width: 100%" src="' . $path . '">', false, 'Page ' . $page, true);
|
||||
|
||||
// Add page 1 as cover
|
||||
if ($page == 1)
|
||||
{
|
||||
// cover
|
||||
$epub->AddImage($path, 'image/jpeg', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$epub->AddPage('<img style="width: 100%" src="' . $path . '">', false, 'Page ' . $page, true);
|
||||
}
|
||||
}
|
||||
|
||||
$articlebody = array_filter($article->ContentItem, function($item) { return $item->ContentType == 'text/xml'; });
|
||||
|
@ -166,12 +151,13 @@
|
|||
$pagecontent .= '<p><img style="width: 100%" src="' . $path . '"></p>';
|
||||
}
|
||||
}
|
||||
|
||||
$pagecontent .= $articlebody->HtmlText;
|
||||
|
||||
if (!$imagesonly)
|
||||
{
|
||||
$epub->AddPage($pagecontent, false, strip_tags($articlebody->Title), true);
|
||||
}
|
||||
// debug
|
||||
// echo '<pre style="white-space: pre-wrap;">' . $pagecontent . '<br>----------------------</pre>';
|
||||
|
||||
$epub->AddPage($pagecontent, false, strip_tags($articlebody->Title), true);
|
||||
}
|
||||
}
|
||||
write_epub($epub);
|
||||
|
|
Loading…
Reference in New Issue