From a7686920270208126d6b88b51d586a83535d7338 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 7 Aug 2025 17:39:04 +0200 Subject: [PATCH] wip #7684 --- app/Fluidbook/Farm.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/Fluidbook/Farm.php b/app/Fluidbook/Farm.php index 49801958d..9caa3391b 100644 --- a/app/Fluidbook/Farm.php +++ b/app/Fluidbook/Farm.php @@ -420,7 +420,13 @@ class Farm public static function extractPDFArea($file, $page, $rect, $to = null, $options = array(), $cache = null) { - $final = Files::mkdir($cache) . Poppler::extractAreaFilehash($file, $page, $rect, $options) . '.' . $options['format']; + $ext = $options['format']; + if ($ext === 'jpeg') { + $ext = 'jpg'; + } + + $final = Files::mkdir($cache) . Poppler::extractAreaFilehash($file, $page, $rect, $options) . '.' . $ext; + if (file_exists($final)) { return $final; } @@ -431,8 +437,8 @@ class Farm ['operation' => 'extractpdfarea', 'pdf' => $file, 'out' => $cache, - 'page' => json_encode($rect), - 'area' => $rect, + 'page' => $page, + 'area' => json_encode($rect), 'options' => json_encode($options)], 0, false, true); }); } -- 2.39.5