From e9033c7f65b1c6cbfa375f1ffa596720d4bdbd0a Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Thu, 15 Jun 2017 16:27:45 +0000 Subject: [PATCH] #1475 @1 --- .../Util/html5/master/class.ws.html5.compiler.php | 15 ++++++++------- inc/ws/Util/html5/master/class.ws.html5.links.php | 12 ------------ 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/inc/ws/Util/html5/master/class.ws.html5.compiler.php b/inc/ws/Util/html5/master/class.ws.html5.compiler.php index e80560888..36e920c7c 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -830,8 +830,6 @@ class wsHTML5Compiler { $this->hiddenContents[] = $c; } $i++; - - $this->log('Link ' . $link->type . ' written'); } $allpages = range(0, $this->book->parametres->pages + 1); @@ -1092,9 +1090,10 @@ class wsHTML5Compiler { $srcPrefix = 'h'; } foreach ($this->pages as $page => $infos) { + $docdir = wsDocument::getDir($infos['document_id']); if ($this->svg) { - $orig = wsDocument::getDir($infos['document_id']) . 'html/p' . $infos['document_page'] . '.svg'; - $opt = wsDocument::getDir($infos['document_id']) . 'html/o' . $infos['document_page'] . '.svg'; + $orig = $docdir . 'html/p' . $infos['document_page'] . '.svg'; + $opt = $docdir . 'html/o' . $infos['document_page'] . '.svg'; $svg = $orig; if (file_exists($opt) && filesize($opt) > 0) { @@ -1105,7 +1104,7 @@ class wsHTML5Compiler { } foreach ($this->getResolutions() as $r) { - $ok = $this->copy(wsDocument::getDir($infos['document_id']) . 'html/' . $srcPrefix . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/data/background/' . $r . '/' . $this->backgroundsPrefix . $page . '.jpg'); + $ok = $this->copy($docdir . 'html/' . $srcPrefix . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/data/background/' . $r . '/' . $this->backgroundsPrefix . $page . '.jpg'); if (!$ok && $r = 300) { $this->maxRes = 150; } @@ -1116,15 +1115,17 @@ class wsHTML5Compiler { $thumb = wsPDFConvert::getThumbFromPDF(WS_BOOKS . '/working/' . $this->book->book_id . '/' . $this->book->parametres->pdfThumbnails, $page); } if (!$thumb) { - $thumb = wsDocument::getDir($infos['document_id']) . 'p' . $infos['document_page'] . '.jpg'; + $thumb = $docdir . 'p' . $infos['document_page'] . '.jpg'; } $this->copy($thumb, $this->vdir . '/data/thumbnails/p' . $page . '.jpg'); if ($page == 1) { - $this->_makeCover(wsDocument::getDir($infos['document_id']) . 'html/t36-' . $infos['document_page'] . '.jpg'); + $this->_makeCover($docdir . 'html/t36-' . $infos['document_page'] . '.jpg'); } + + $this->log('Copied image '.$page); } } 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 f251fb3d8..903dfc445 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -1228,21 +1228,15 @@ class zoomLink extends normalLink { } public function generateImage() { - $this->compiler->log('Before generating image'); - $left = CubeIT_Files::tempnam(); $p = wsDAOBook::getDocumentPage($this->compiler->book_id, $this->page); - $this->compiler->log('Got document page'); $pdfpath = wsDocument::getDir($p['document_id']) . 'original.pdf'; - $this->compiler->log('Got pdf original'); $leftfile = CubeIT_CommandLine_Poppler::extractArea($pdfpath, $p['document_page'], array('x' => $this->left, 'y' => $this->top, 'width' => $this->width, 'height' => $this->height), $left, array(), WS_CACHE . '/zoomarea/' . $this->compiler->book_id . '/'); - $this->compiler->log('Left file generated'); - $bookwidth = $this->compiler->book->parametres->width; if (($this->left + $this->width) > $bookwidth) { @@ -1255,18 +1249,13 @@ class zoomLink extends normalLink { array('x' => 0, 'y' => $this->top, 'width' => $diff, 'height' => $this->height), $right, array(), WS_CACHE . '/zoomarea/' . $this->compiler->book_id . '/'); - $this->compiler->log('Left file generated'); - $both = CubeIT_Files::tempnam() . '.jpg'; CubeIT_CommandLine_Imagemagick::append(array($leftfile, $rightfile), $both, 'horizontal'); - - $this->compiler->log('Both files assembled'); } else { $both = $leftfile; } $this->compiler->simpleCopyLinkFile($both, 'data/links/zoom_' . $this->id . '.jpg'); - $this->compiler->log('Files copied'); // Perform tidy up and delete temporary files if they exist $files_to_delete = ['left', 'leftfile', 'right', 'rightfile', 'both']; @@ -1275,7 +1264,6 @@ class zoomLink extends normalLink { unlink($$file); } } - $this->compiler->log('Files cleaned up'); } -- 2.39.5