use hollodotme\FastCGI\Client;
use hollodotme\FastCGI\Requests\PostRequest;
use hollodotme\FastCGI\SocketConnections\NetworkSocket;
+use Illuminate\Support\Facades\Cache;
class Farm
{
$hash = Files::hashFileAttributes($pdf);
$out = Files::mkdir(protected_path('fluidbookpublication/cache/pdffiles/' . $hash));
}
- $params = ['toolbox' => 1,
- 'pdf' => $pdf,
+
+ $attrs = ['pdf' => $pdf,
'page' => $page,
'format' => $format,
'resolution' => $resolution,
'withText' => $withText,
'withGraphics' => $withGraphics,
'version' => $version,
- 'force' => $force,
'out' => $out];
- return self::_getFile($params);
+
+ $cachekey = 'filefrompdf_' . hash('sha256', print_r($attrs, true));
+
+ $params = array_merge($attrs, ['toolbox' => 1,
+ 'force' => $force,
+ ]);
+
+ if ($force) {
+ Cache::forget($cachekey);
+ }
+
+ return Cache::rememberForever($cachekey, function () use ($params) {
+ return self::_getFile($params);
+ });
}
protected static function _getFile($params)
, 'data/contents/p' . $page . '.svg');
}
- $this->vdir->copy($this->getFluidbook()->getThumbFile($page, $this->imageFormat), 'data/thumbnails/p' . $page . '.' . $this->imageFormat);
+ $t=$this->getFluidbook()->getThumbFile($page, $this->imageFormat);
+ $this->vdir->copy($t, 'data/thumbnails/p' . $page . '.' . $this->imageFormat);
$this->log('Made image page ' . $page);
}