]> _ Git - cubist_util.git/commitdiff
#7684
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 7 Aug 2025 15:07:01 +0000 (17:07 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 7 Aug 2025 15:07:01 +0000 (17:07 +0200)
src/CommandLine/Poppler.php

index 289b590681d7d4ca354162fe3e9938effdc42430..1915bcfe34a4b602da611811ab147af5fd489e8b 100644 (file)
@@ -43,8 +43,8 @@ class Poppler
         $cacheFile = null;
         if (null !== $cache) {
             Files::mkdir($cache);
-            $f = Files::hashFileAttributes($file) . '||' . '++' . json_encode($rect) . '**' . json_encode($options) . '||' . $page . '!!';
-            $hash = hash('sha256', $f);
+
+            $hash = self::filehash($file, $page, $rect, $options);
 
             $cacheFileWithoutExt = $cache . $hash;
             $cacheFile = $cacheFileWithoutExt . '.' . $extension;
@@ -95,7 +95,7 @@ class Poppler
             $pdftoppm->setArg('-freetype', (!isset($options['texts']) || $options['texts']) ? 'yes' : 'no');
             $pdftoppm->setArg('-singlefile');
             self::_crop($pdftoppm, $page, $rect, $options['resolution'], $options['factor']);
-            self::_exec($pdftoppm, $file, $dest,true);
+            self::_exec($pdftoppm, $file, $dest, true);
         }
 
         if (isset($lockFile)) {
@@ -111,6 +111,12 @@ class Poppler
         return $res;
     }
 
+    public static function filehash($file, $page, $rect, $options)
+    {
+        $f = Files::hashFileAttributes($file) . '||' . '++' . json_encode($rect) . '**' . json_encode($options) . '||' . $page . '!!';
+        return hash('sha256', $f);
+    }
+
     /**
      * @param $file
      * @param $page