height: options.height / options.scale,\r
deviceScaleFactor: options.scale,\r
});\r
+ await page.setDefaultNavigationTimeout(0);\r
await page.goto(options.url);\r
await new Promise(r => setTimeout(r, 1000 * options.delay));\r
await page.screenshot({path: options.dest, type: 'jpeg', quality: 95});\r
{
$this->outputXML = false;
$dao = new wsDAOBook($this->con);
+ $daoTheme = new wsDAOTheme($this->con);
if (isset($this->args['id']) && $this->args['id'] <= 18972) {
$book = $dao->selectById($this->args['id']);
if (!isset($cover)) {
$cover = WS_FILES . '/social_image/' . $id . '.jpg';
- $limit = TIME - (3600 * 24 * 30);
+ $theme = $daoTheme->selectById($book->theme);
+ $limit = max(TIME - (3600 * 24 * 30), $book->changedate, $theme->date);
$minsize = 20 * 1024;
+ //die($limit . ':' . $book->changedate . '//' . filemtime($cover));
if (isset($_GET['force']) || !file_exists($cover) || filemtime($cover) < $limit || filesize($cover) < $minsize) {
touch($lock);
$url = 'https://workshop.fluidbook.com/viewerh/' . $id . '_' . $book->hash . '_' . TIME . '/?nointerface=1';
- if (isset($_GET['forcecompile'])) {
+ if ((file_exists($cover) && filemtime($cover) < $limit) || isset($_GET['forcecompile'])) {
$url .= '&force=1';
}
$url .= '#/page/0';
$w = 1200;
$h = 628;
-// $tmp = CubeIT_Files::tempnam() . '.svg';
-// $cl = new CubeIT_CommandLine('xvfb-run');
-// $cl->setArg('a');
-// $cl->setArg('server-args', '-screen 0, ' . $w . 'x' . $h . 'x24');
-// $cl->setArg(null, '/usr/bin/cutycapt');
-// $cl->setArg('min-width', $w);
-// $cl->setArg('min-height', $h);
-// $cl->setArg('zoom-factor', 0.5);
-// $cl->setArg('url', $url);
-// $cl->setArg('delay', 10000);
-// $cl->setArg('out', $tmp);
-// $cl->execute();
-// $cl->debug();
-//
-// $geo = $w . 'x' . $h;
-// `convert $tmp -crop $geo+0+0 +repage -resize $geo -flatten $cover`;
-// unlink($tmp);
+
$cl = new CubeIT_CommandLine('node');
$cl->setArg(null, WS_TOOLS . '/social_screenshot/social_screenshot.js');