diff --git a/epub.php b/epub.php index 1330187..76396f5 100644 --- a/epub.php +++ b/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('', 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('', false, 'Page ' . $page, true); + } } $articlebody = array_filter($article->ContentItem, function($item) { return $item->ContentType == 'text/xml'; }); @@ -161,13 +166,12 @@ $pagecontent .= '

'; } } - $pagecontent .= $articlebody->HtmlText; - // debug - // echo '
' . $pagecontent . '
----------------------
'; - - $epub->AddPage($pagecontent, false, strip_tags($articlebody->Title), true); + if (!$imagesonly) + { + $epub->AddPage($pagecontent, false, strip_tags($articlebody->Title), true); + } } } write_epub($epub);