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

index 09348129c3e7ec1c4e48fb1f0e3c7e1dd2b5dd2b..49801958d655efff19854b5fee6884dfa75eaeb2 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace App\Fluidbook;
 
+use Cubist\Util\CommandLine\Poppler;
 use Cubist\Util\Files\Files;
 use Fluidbook\Tools\Jobs\ProcessFile;
 use hollodotme\FastCGI\Client;
@@ -419,6 +420,11 @@ 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'];
+        if (file_exists($final)) {
+            return $final;
+        }
+
         $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(