예제 #1
0
 /**
  * submit the http request to the node server to generate the thumbnail
  * @param $assetHref
  * @return boolean
  */
 public function requestThumbnail($assetHref)
 {
     $url = Configure::read('Chaucer.thumbnailHost');
     if (strlen($url) > 0) {
         $pageKey = Configure::read('Chaucer.rootFolder') . $this->bookId . '/' . $this->epub->epubRoot() . dirname($this->epub->EpubSpine->getContentOpfLocation()) . '/' . $assetHref;
         $rest = new RestClient();
         $bookItem = $this->bookData->getBookItem();
         $width = (int) $bookItem['ChChaucerBookVersion']['book_width'];
         $height = (int) $bookItem['ChChaucerBookVersion']['book_height'];
         if (!$width) {
             $width = 768;
             $height = 1024;
         }
         CakeLog::debug('[ImportProcessor::requestThumbnail] Requesting thumbnail from ' . $url . ' for path ' . $pageKey . ' height: ' . $height . ' width:' . $width);
         $response = $rest->setUrl($url)->setData(array('path' => $pageKey, 'height' => $height, 'width' => $width, 'bucket' => Configure::read('Chaucer.s3Bucket')))->get();
         return $rest->isGoodResponse();
     }
     return false;
 }