예제 #1
0
 /**
  * Retrieves the thumbnail to send back to the browser
  *
  * The thumbnail is either a resized preview of the file or the original file
  * Thumbnails are base64encoded before getting sent back
  *
  *
  * @param int $fileId the ID of the file of which we need a thumbnail preview of
  * @param bool $square whether the thumbnail should be square
  * @param double $scale whether we're allowed to scale the preview up
  *
  * @return array<string,array|string>
  */
 private function getThumbnail($fileId, $square, $scale)
 {
     list($width, $height, $aspect, $animatedPreview, $base64Encode) = $this->thumbnailService->getThumbnailSpecs($square, $scale);
     /** @type File $file */
     list($file, $preview, $status, $type) = $this->getData($fileId, $width, $height, $aspect, $animatedPreview, $base64Encode);
     if ($preview === null) {
         $preview = $this->prepareEmptyThumbnail($file, $status);
     } else {
         if ($type === 'preview') {
             $preview['preview'] = $this->previewService->previewValidator($square, $base64Encode);
         }
     }
     return [$preview, $status];
 }
 /**
  * @expectedException \OCA\Gallery\Service\InternalServerErrorServiceException
  */
 public function testPreviewValidatorWithBrokenSetup()
 {
     $square = true;
     $base64Encode = true;
     $this->mockPreviewValidatorWithBrokenSystem();
     $this->service->previewValidator($square, $base64Encode);
 }