le monde add experimental image only mode
This commit is contained in:
parent
2c7c35cb09
commit
74ad25f7e3
18
epub.php
18
epub.php
|
@ -72,6 +72,8 @@
|
|||
// parameters hardcoded for now
|
||||
$includeimages = false;
|
||||
$includepages = true;
|
||||
$imagesonly = false;
|
||||
$imagesize = $imagesonly ? "XLARGE" : "MEDIUM";
|
||||
|
||||
$url = $_POST['lmurl'];
|
||||
|
||||
|
@ -122,14 +124,17 @@
|
|||
}))[0];
|
||||
$pageid = $pageobj->PublicationPageID;
|
||||
|
||||
$path = lm_download_image($url, 'Preview-MEDIUM-', $pageid);
|
||||
$epub->AddPage('<img style="width: 100%" src="' . $path . '">', false, 'Page ' . $page, true);
|
||||
$path = lm_download_image($url, 'Preview-' . $imagesize . '-', $pageid);
|
||||
|
||||
// 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'; });
|
||||
|
@ -161,15 +166,14 @@
|
|||
$pagecontent .= '<p><img style="width: 100%" src="' . $path . '"></p>';
|
||||
}
|
||||
}
|
||||
|
||||
$pagecontent .= $articlebody->HtmlText;
|
||||
|
||||
// debug
|
||||
// echo '<pre style="white-space: pre-wrap;">' . $pagecontent . '<br>----------------------</pre>';
|
||||
|
||||
if (!$imagesonly)
|
||||
{
|
||||
$epub->AddPage($pagecontent, false, strip_tags($articlebody->Title), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
write_epub($epub);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue