if ($page == 1) {
$this->_makeCover($docdir . 'html/t36-' . $infos['document_page'] . '.jpg');
}
- $this->makeThumbSprites($thumbs);
+
$this->log('Copied image ' . $page);
}
+
+ $this->makeThumbSprites($thumbs);
+ $this->log('Made thumbnails');
}
public function makeThumbSprites(array $thumbs) {
}
$css = '#l_' . $this->id . '{';
- $css .= 'left:' . $this->left * $this->getCssScale() . 'px;top:' . $this->top * $this->getCssScale() . 'px;';
- $css .= 'width:' . $this->width * $this->getCssScale() . 'px;height:' . $this->height * $this->getCssScale() . 'px;';
+ $css .= 'left:' . round($this->left * $this->getCssScale()) . 'px;top:' . round($this->top * $this->getCssScale()) . 'px;';
+ $css .= 'width:' . round($this->width * $this->getCssScale()) . 'px;height:' . round($this->height * $this->getCssScale()) . 'px;';
$origin = false;
if ($this->rot) {
$css .= wsHTML5::writeCSSUA('transform', 'rotate(' . $this->rot . 'deg)');
}
public function generateImage() {
- $left = CubeIT_Files::tempnam();
- $maxzoom = $this->to;
+ $maxzoom = ((int)$this->to !== 0) ? $this->to : 2; // Max zoom level might not always be set in the link editor
+
+ // TODO: Consider generating higher-res images (eg. 2x) for HiDPI screens. Maybe some extra optimisations can be done on the larger images...
+
$extractOptions = [
// The Poppler::extractArea function accepts a resolution setting and uses that to determine the
// scale factor on the extracted images. It does so by dividing by 72, so we can pass our own scale
$p = wsDAOBook::getDocumentPage($this->compiler->book_id, $this->page);
$pdfpath = wsDocument::getDir($p['document_id']) . 'original.pdf';
+ $left = CubeIT_Files::tempnam();
$leftfile = CubeIT_CommandLine_Poppler::extractArea($pdfpath,
$p['document_page'],
array('x' => $x, 'y' => $y, 'width' => $w, 'height' => $h),