Exemplo n.º 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) = $this->getData($fileId, $width, $height, $aspect, $animatedPreview, $base64Encode);
     if ($preview === null) {
         $preview = $this->prepareEmptyThumbnail($file, $status);
     }
     return [$preview, $status];
 }
 /**
  * @param $square
  * @param $scale
  * @param $array
  */
 private function mockGetThumbnailSpecs($square, $scale, $array)
 {
     $this->thumbnailService->expects($this->once())->method('getThumbnailSpecs')->with($square, $scale)->willReturn($array);
 }