From 32bfde7f2502dcdc4b9f80d533b1e9ae75340e3d Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 7 Aug 2025 17:07:01 +0200 Subject: [PATCH] #7684 --- src/CommandLine/Poppler.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/CommandLine/Poppler.php b/src/CommandLine/Poppler.php index 289b590..1915bcf 100644 --- a/src/CommandLine/Poppler.php +++ b/src/CommandLine/Poppler.php @@ -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 -- 2.39.5