$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;
$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)) {
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