]> _ Git - cubeextranet.git/commitdiff
done #901 @0.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 12 Jun 2017 17:01:59 +0000 (17:01 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 12 Jun 2017 17:01:59 +0000 (17:01 +0000)
inc/ws/Util/html5/master/class.ws.html5.links.php
inc/ws/Util/html5/slider/class.ws.html5.compiler.php

index 7b407ca5c1b650b5711c91a64b2a1e020a8a1da9..15a8bdf56beea74e67607361135465e36c24ccee 100644 (file)
@@ -355,7 +355,6 @@ class tooltipLink extends normalLink {
 }
 
 class htmlMultimediaImage extends wsHTML5Link {
-
        public function getHTMLContainerClass() {
                return parent::getHTMLContainerClass() . ' multimedia';
        }
index b1c522341c2dc0634d207f2317553631605abcf5..068b0877e87ebe4aad951aafc61600de1053da1e 100644 (file)
@@ -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;}';