From c069f1c9be45b396f8b6db2c6863079e23c957eb Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 12 Jun 2017 17:01:59 +0000 Subject: [PATCH] done #901 @0.5 --- .../html5/master/class.ws.html5.links.php | 1 - .../html5/slider/class.ws.html5.compiler.php | 25 +++++++++++++------ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/inc/ws/Util/html5/master/class.ws.html5.links.php b/inc/ws/Util/html5/master/class.ws.html5.links.php index 7b407ca5c..15a8bdf56 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -355,7 +355,6 @@ class tooltipLink extends normalLink { } class htmlMultimediaImage extends wsHTML5Link { - public function getHTMLContainerClass() { return parent::getHTMLContainerClass() . ' multimedia'; } diff --git a/inc/ws/Util/html5/slider/class.ws.html5.compiler.php b/inc/ws/Util/html5/slider/class.ws.html5.compiler.php index b1c522341..068b0877e 100644 --- a/inc/ws/Util/html5/slider/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/slider/class.ws.html5.compiler.php @@ -1059,6 +1059,7 @@ class wsHTML5Compiler { if ($this->backgroundsPrefix == 'p') { $srcPrefix = 'h'; } + $thumbs = array(); foreach ($this->pages as $page => $infos) { if ($this->svg) { $orig = wsDocument::getDir($infos['document_id']) . 'html/p' . $infos['document_page'] . '.svg'; @@ -1087,36 +1088,44 @@ class wsHTML5Compiler { $thumb = wsDocument::getDir($infos['document_id']) . 'p' . $infos['document_page'] . '.jpg'; } - - $this->copy($thumb, $this->vdir . '/data/thumbnails/p' . $page . '.jpg'); + $thumbs[$page] = $thumb; if ($page == 1) { $this->_makeCover(wsDocument::getDir($infos['document_id']) . 'html/t36-' . $infos['document_page'] . '.jpg'); } } - $this->makeThumbSprites(); + $this->makeThumbSprites($thumbs); } - public function makeThumbSprites() { + public function makeThumbSprites(array $thumbs) { $cols = 10; $rows = 10; $perSprite = $cols * $rows; $k = 0; $res = ''; - $pages = count($this->pages); + $pages = count($thumbs); + $hash = ''; for ($i = 1; $i <= $pages; $i += $perSprite) { $num = min(1 + $pages - $i, $perSprite); $srows = ceil($num / $cols); $files = array(); + $mtime = 0; for ($j = 0; $j < $perSprite; $j++) { $p = $i + $j; if ($p > $pages) { break; } - $files[] = $this->vdir . '/data/thumbnails/p' . $p . '.jpg'; + $files[] = $thumbs[$p]; + $hash .= $thumbs[$p] . '--' . filemtime($thumbs[$p]); + } + + $cache = WS_CACHE . '/thumbsprites/' . hash('sha256', $hash) . '.jpg'; + $dest = $this->vdir . '/data/thumbnails/s' . $k . '.jpg'; + if (!file_exists($cache)) { + $cmd = 'montage ' . implode(' ', $files) . ' -geometry 100x+0+0 -background transparent -tile ' . $cols . 'x' . $srows . ' ' . $cache; } - $cmd = 'montage ' . implode(' ', $files) . ' -geometry 100x+0+0 -background transparent -tile ' . $cols . 'x' . $srows . ' ' . $this->vdir . '/data/thumbnails/s' . $k . '.jpg'; + copy($cache, $dest); $res .= `$cmd`; $k++; } @@ -1204,7 +1213,7 @@ class wsHTML5Compiler { $res[] = '.landscape #shadow>div.right{left: ' . $w . ';}'; $res[] = '.landscape .page.right{left:' . $w . '}'; if ($this->theme->parametres->displayPageNumber) { - $res[] = '#pagesnumbers{font-size: ' . (13 * $this->z) . 'px;margin: ' . (5 * $this->z) . 'px 0 0 0;top:' . $h . ';color:' . wsHTML5::colorToCSS($this->theme->parametres->colorPageNumber) . '}'; + $res[] = '#pagesnumbers{font-size: ' . (11 * $this->z) . 'px;margin: ' . (5 * $this->z) . 'px 0 0 0;top:' . $h . ';color:' . wsHTML5::colorToCSS($this->theme->parametres->colorPageNumber) . '}'; $res[] = '#pagesnumbers div{width:' . $w . '}'; } else { $res[] = '#pagesnumbers{display:none;}'; -- 2.39.5