From 19657ef92f53176ba41f4dc096072bf1b8b2834d Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Mon, 8 Jul 2024 11:46:51 +0200 Subject: [PATCH] remove lm parameters --- epub.php | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/epub.php b/epub.php index e9c51d5..2787b83 100644 --- a/epub.php +++ b/epub.php @@ -211,12 +211,6 @@ // Le Monde if (isset($_POST['lemonde']) && $_POST['lemonde']) { - // parameters hardcoded for now - $includeimages = false; - $includepages = true; - $imagesonly = false; - $imagesize = $imagesonly ? "XLARGE" : "MEDIUM"; - $url = $_POST['lmurl']; // extract url from curl command @@ -248,10 +242,7 @@ $content = array_filter($publication->Content, function($item) { return $item->Category == 'Le Monde'; }); usort($content, function ($a, $b) { return $a->PageNumber - $b->PageNumber; }); - if ($includepages) - { - $pageindex = json_decode(file_get_contents(str_replace('GetPublicationContentItems', 'GetPublicationPages', $url))); - } + $pageindex = json_decode(file_get_contents(str_replace('GetPublicationContentItems', 'GetPublicationPages', $url))); $page = 0; foreach ($content as $article) @@ -266,7 +257,7 @@ }))[0]; $pageid = $pageobj->PublicationPageID; - $path = lm_download_image($url, 'Preview-' . $imagesize . '-', $pageid); + $path = lm_download_image($url, 'Preview-MEDIUM-', $pageid); if ($page == 1) { @@ -298,22 +289,9 @@ { $pagecontent .= '' . $articlebody->Introduction . ''; } - - if ($includeimages) - { - $images = array_values(array_filter($article->ContentItem, function($item) { return $item->ContentType == 'graphic/jpeg' || $item->ContentType == 'image/jpeg'; })); - foreach ($images as $image) - { - $path = lm_download_image($url, 'Image-MEDIUM-', $image->ContentItemId); - $pagecontent .= '

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