From: vincent@cubedesigners.com Date: Tue, 23 Jun 2020 15:48:09 +0000 (+0000) Subject: wip #3497 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=d19c616410b4e16bddeba1dc69d01696d351cc56;p=cubeextranet.git wip #3497 @1 --- 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 45cc713da..b48fb2457 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -1305,7 +1305,12 @@ class downloadPortionLink extends fileLink public function getZoomAttributes() { - return [ + $pdf = $this->compiler->book->parametres->downloadPortionPDF; + if ($pdf !== '') { + $pdf = $this->compiler->wdir . '/' . $this->compiler->book->parametres->downloadPortionPDF; + } + + $res = [ 'id' => $this->id, 'page' => $this->page, 'maxzoom' => $this->compiler->book->parametres->downloadPortionZoom, @@ -1314,11 +1319,12 @@ class downloadPortionLink extends fileLink 'width' => round($this->width), 'height' => round($this->height), 'x' => round($this->left), - 'y' => round($this->top) + 'y' => round($this->top), + 'pdf' => $pdf, ]; + return $res; } - public function getAdditionnalContent() { $file = $this->to; @@ -1957,22 +1963,35 @@ class zoomLink extends normalLink //error_log("--- Book Width: $bookwidth ---"); - $p = wsDAOBook::getDocumentPage($compiler->book_id, $attributes['page']); - $pdfpath = wsDocument::getDir($p['document_id']) . '/pdf/p' . $p['document_page'] . '.pdf'; + if (!isset($attributes['pdf']) || !$attributes['pdf']) { + $p = wsDAOBook::getDocumentPage($compiler->book_id, $attributes['page']); + $pdfpath = wsDocument::getDir($p['document_id']) . '/pdf/p' . $p['document_page'] . '.pdf'; + $extractPage = 1; + } else { + $pdfpath = $attributes['pdf']; + $extractPage = $attributes['page']; + } $left = CubeIT_Files::tempnam(); $leftfile = CubeIT_CommandLine_Poppler::extractArea($pdfpath, - 1, + $extractPage, array('x' => $x, 'y' => $y, 'width' => $w, 'height' => $h), $left, $extractOptions, WS_CACHE . '/' . $cachedir . '/' . $compiler->book_id . '/'); if (($x + $w) > $bookwidth) { - $p = wsDAOBook::getDocumentPage($compiler->book_id, $attributes['page'] + 1); - $pdfpath = wsDocument::getDir($p['document_id']) . '/pdf/p' . $p['document_page'] . '.pdf'; + if (!isset($attributes['pdf']) || !$attributes['pdf']) { + $p = wsDAOBook::getDocumentPage($compiler->book_id, $attributes['page'] + 1); + $pdfpath = wsDocument::getDir($p['document_id']) . '/pdf/p' . $p['document_page'] . '.pdf'; + $extractPage = 1; + } else { + $pdfpath = $attributes['pdf']; + $extractPage = $attributes['page'] + 1; + } + $diff = ($w + $x) - $bookwidth; $right = CubeIT_Files::tempnam(); $rightfile = CubeIT_CommandLine_Poppler::extractArea($pdfpath, - 1, + $extractPage, array('x' => 0, 'y' => $y, 'width' => $diff, 'height' => $h), $right, $extractOptions, WS_CACHE . '/' . $cachedir . '/' . $compiler->book_id . '/');