$this->hiddenContents[] = $c;
}
$i++;
-
- $this->log('Link ' . $link->type . ' written');
}
$allpages = range(0, $this->book->parametres->pages + 1);
$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) {
}
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;
}
$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);
}
}
}
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) {
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'];
unlink($$file);
}
}
- $this->compiler->log('Files cleaned up');
}