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

index e19b2efaf0b516de6493a4110b5eab655febb339..dabb0d4c82c686f4165765dbf5b6b998a3421feb 100644 (file)
@@ -309,6 +309,13 @@ class Farm
     protected static function _getFile($params, $attempts = 3, $checkOutput = true, $preferLocal = false)
     {
         $start = microtime(true);
+
+        if ($params['operation'] === 'extractpdfarea') {
+            static::$_forceServer = 'amadeus';
+        } else {
+            static::$_forceServer = false;
+        }
+
         $farmer = self::pickOneServer($preferLocal, $params);
 
         $params['toolbox'] = '1';
@@ -403,14 +410,15 @@ class Farm
 
     public static function extractPDFArea($file, $page, $rect, $to = null, $options = array(), $cache = null)
     {
-        return static::lock($file, 'pdfarea_' . $file . '_' . $page . '_' . md5(json_encode($rect)) . '_' . md5(json_encode($options)), function () use ($file, $page, $rect, $to, $options, $cache) {
+        $lock = 'pdfarea_' . hash('sha256', $file . '_' . $page . '_' . json_encode($rect) . '_' . json_encode($options));
+        return static::lock($file, $lock, function () use ($file, $page, $rect, $to, $options, $cache) {
             return self::_getFile(
                 ['operation' => 'extractpdfarea',
                     'pdf' => $file,
                     'out' => $cache,
-                    'page' => $page,
+                    'page' => json_encode($rect),
                     'area' => $rect,
-                    'options' => $options], 0, false, true);
+                    'options' => json_encode($options)], 0, false, true);
         });
     }
 }