]> _ Git - cubeextranet.git/commitdiff
wip #1363 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 26 Apr 2017 10:07:35 +0000 (10:07 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 26 Apr 2017 10:07:35 +0000 (10:07 +0000)
inc/ws/Util/html5/class.ws.html5.links.php

index df326ab8566de5f9f436168298265234ed16fc1f..12c4b8aec9263ddabac32526142cac4e86c8ac27 100644 (file)
@@ -1122,11 +1122,29 @@ class zoomLink extends normalLink {
                $pdfpath = wsDocument::getDir($p['document_id']) . 'original.pdf';
 
                CubeIT_CommandLine_Poppler::extractArea($pdfpath,
-                       $this->page,
+                       $p['document_page'],
                        array('x' => $this->left, 'y' => $this->top, 'width' => $this->width, 'height' => $this->height),
                        $left);
 
-               $this->compiler->simpleCopyLinkFile($left . '.png', 'data/links/zoom_' . $this->id . '.png');
+               $bookwidth = $this->compiler->book->parametres->width;
+
+               if (($this->left + $this->width) > $bookwidth) {
+                       $p = wsDAOBook::getDocumentPage($this->compiler->book_id, $this->page + 1);
+                       $pdfpath = wsDocument::getDir($p['document_id']) . 'original.pdf';
+                       $diff = ($this->width + $this->left) - $bookwidth;
+                       $right = CubeIT_Files::tempnam();
+                       CubeIT_CommandLine_Poppler::extractArea($pdfpath,
+                               $p['document_page'],
+                               array('x' => 0, 'y' => $this->top, 'width' => $diff, 'height' => $this->height),
+                               $right);
+
+                       $both = CubeIT_Files::tempnam() . '.png';
+                       CubeIT_CommandLine_Imagemagick::append(array($left . '.png', $right . '.png'), $both, 'horizontal');
+               } else {
+                       $both = $left . '.png';
+               }
+
+               $this->compiler->simpleCopyLinkFile($both, 'data/links/zoom_' . $this->id . '.png');
        }