]> _ Git - fluidbook-toolbox.git/commitdiff
wip #7684
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 7 Aug 2025 15:39:04 +0000 (17:39 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 7 Aug 2025 15:39:04 +0000 (17:39 +0200)
app/Fluidbook/Farm.php

index 49801958d655efff19854b5fee6884dfa75eaeb2..9caa3391b16242fa5fd6287b66812d339ad5e41a 100644 (file)
@@ -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);
         });
     }