$extractPage = $attributes['page'] + 1;
}
- $diff = ($w + $x) - $bookwidth;
- $right = CubeIT_Files::tempnam();
- $rightfile = CubeIT_CommandLine_Poppler::extractArea($pdfpath,
- $extractPage,
- array('x' => 0, 'y' => $y, 'width' => $diff, 'height' => $h),
- $right, $extractOptions, wsBook::getCacheDir($compiler->book_id) . $cachedir . '/' . $compiler->book_id . '/');
-
- if (!file_exists($rightfile)) {
- die('Error generating right part ' . $rightfile);
- }
- $both = CubeIT_Files::tempnam() . '.jpg';
- CubeIT_CommandLine_Imagemagick::append(array($leftfile, $rightfile), $both, 'horizontal');
- if (!file_exists($both)) {
- die('Error glueing ' . $leftfile . ' and ' . $rightfile);
+ if (!file_exists($pdfpath)) {
+ $both = $leftfile;
+ } else {
+
+ $diff = ($w + $x) - $bookwidth;
+ $right = CubeIT_Files::tempnam();
+ $rightfile = CubeIT_CommandLine_Poppler::extractArea($pdfpath,
+ $extractPage,
+ array('x' => 0, 'y' => $y, 'width' => $diff, 'height' => $h),
+ $right, $extractOptions, wsBook::getCacheDir($compiler->book_id) . $cachedir . '/' . $compiler->book_id . '/');
+
+ if (!file_exists($rightfile)) {
+ die('Error generating right part ' . $rightfile);
+ }
+
+ $both = CubeIT_Files::tempnam() . '.jpg';
+ CubeIT_CommandLine_Imagemagick::append(array($leftfile, $rightfile), $both, 'horizontal');
+ if (!file_exists($both)) {
+ die('Error glueing ' . $leftfile . ' and ' . $rightfile);
+ }
}
} else {
$both = $leftfile;