remove lm parameters

This commit is contained in:
quenousimporte 2024-07-08 11:46:51 +02:00
parent bf56f2e120
commit 19657ef92f
1 changed files with 3 additions and 25 deletions

View File

@ -211,12 +211,6 @@
// Le Monde // Le Monde
if (isset($_POST['lemonde']) && $_POST['lemonde']) if (isset($_POST['lemonde']) && $_POST['lemonde'])
{ {
// parameters hardcoded for now
$includeimages = false;
$includepages = true;
$imagesonly = false;
$imagesize = $imagesonly ? "XLARGE" : "MEDIUM";
$url = $_POST['lmurl']; $url = $_POST['lmurl'];
// extract url from curl command // extract url from curl command
@ -248,10 +242,7 @@
$content = array_filter($publication->Content, function($item) { return $item->Category == 'Le Monde'; }); $content = array_filter($publication->Content, function($item) { return $item->Category == 'Le Monde'; });
usort($content, function ($a, $b) { return $a->PageNumber - $b->PageNumber; }); 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; $page = 0;
foreach ($content as $article) foreach ($content as $article)
@ -266,7 +257,7 @@
}))[0]; }))[0];
$pageid = $pageobj->PublicationPageID; $pageid = $pageobj->PublicationPageID;
$path = lm_download_image($url, 'Preview-' . $imagesize . '-', $pageid); $path = lm_download_image($url, 'Preview-MEDIUM-', $pageid);
if ($page == 1) if ($page == 1)
{ {
@ -298,22 +289,9 @@
{ {
$pagecontent .= '<b>' . $articlebody->Introduction . '</b>'; $pagecontent .= '<b>' . $articlebody->Introduction . '</b>';
} }
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 .= '<p><img style="width: 100%" src="' . $path . '"></p>';
}
}
$pagecontent .= $articlebody->HtmlText; $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); write_epub($epub);