From: Vincent Vanwaelscappel Date: Thu, 7 Aug 2025 15:07:01 +0000 (+0200) Subject: #7684 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=32bfde7f2502dcdc4b9f80d533b1e9ae75340e3d;p=cubist_util.git #7684 --- 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