]> _ Git - cubeextranet.git/commitdiff
wip #4932 @0.75
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 2 Dec 2021 20:08:26 +0000 (20:08 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 2 Dec 2021 20:08:26 +0000 (20:08 +0000)
inc/ws/Util/html5/master/class.ws.html5.links.php

index d01523392fa750192a2e9a8feaabb00a17dfe589..69c06e09f636580f493fdfad9e96e9acd6b583f8 100644 (file)
@@ -3088,9 +3088,21 @@ class articlePDFLink extends articleLink
             $infos = json_decode(file_get_contents($infosfile));
         }
 
-        $this->copyExternalFile($this->to);
+        $cut = $this->wdir . $name . '.c.pdf';
+        if (true || !file_exists($cut)) {
+            $ratio = $infos->width / $infos->height;
+            $nb = max(1, ceil(0.7 / $ratio));
+
+            if ($nb == 1) {
+                copy($pdffile, $cut);
+            } else {
+                `mutool poster -y $nb $pdffile $cut`;
+            }
+        }
+
+        $this->copyExternalFile($name . '.c.pdf');
         $text = file_get_contents($htmlfile);
-        $this->article = ['page' => $this->page, 'type' => 'pdf', 'id' => $name, 'url' => $name, 'infos' => $infos, 'content' => $this->to, 'textcontent' => $text];
+        $this->article = ['page' => $this->page, 'type' => 'pdf', 'id' => $name, 'url' => $name, 'infos' => $infos, 'content' => $name . '.c.pdf', 'textcontent' => $text];
         $this->compiler->config->articlesList[] = $this->article;
         $this->compiler->addSEOArticle('#/article/' . $name, $this->title, $this->description, '', $name, $name . '.html', $text);
     }