/** * Adds a page to the beginning of the book to display the cover page. uses the book_cover field from the books * table to determine the image file * * @return string path to cover image. Relative in S3, absolute locally */ public function setCoverImage() { $book = $this->bookData->getBookItem(); $coverSource = trim($book['ChChaucerBook']['book_cover']); $path = ''; if (strlen($coverSource) > 0) { CakeLog::debug('[ImportProcessor::addCoverPageImage] Book ' . $book['ChChaucerBook']['book_id'] . ' has cover image: ' . $coverSource); $path = $this->epub->addCoverImage(Folder::addPathElement(Configure::read('Chaucer.sourceDir'), $coverSource)); $book['ChChaucerBook']['book_cover'] = $coverSource; $this->bookData->saveBook($book); return $this->epub->epubRoot() . $path; } return ''; }