예제 #1
0
 /**
  * Resizes, crops, fixes orientation and stores in the cache
  *
  * @param int $fileId fileId of the original image
  */
 private function resizeAndStore($fileId)
 {
     // Resize and store
     $this->resizeAndCrop();
     // We save a copy in the cache to speed up future calls
     $cachePath = $this->buildCachePath($fileId);
     $this->userView->file_put_contents($cachePath, $this->preview->data());
 }
예제 #2
0
파일: preview.php 프로젝트: unrealbato/core
 /**
  * Saves a preview in the cache to speed up future calls
  *
  * Do not nullify the preview as it might send the whole process in a loop
  *
  * @param int $fileId fileId of the original image
  * @param int $previewWidth
  * @param int $previewHeight
  */
 private function storePreview($fileId, $previewWidth, $previewHeight)
 {
     if (empty($previewWidth) || empty($previewHeight)) {
         \OCP\Util::writeLog('core', 'Cannot save preview of dimension ' . $previewWidth . 'x' . $previewHeight, \OCP\Util::DEBUG);
     } else {
         $cachePath = $this->buildCachePath($fileId, $previewWidth, $previewHeight);
         $this->userView->file_put_contents($cachePath, $this->preview->data());
     }
 }