/** * @expectedException \OCA\Gallery\Service\InternalServerErrorServiceException */ public function testCreatePreviewWithBrokenSystem() { /** @type File $file */ $file = $this->mockJpgFile(12345); $this->mockGetUserIdFails(); $this->service->createPreview($file, $maxX = 0, $maxY = 0, $keepAspect = true, $base64Encode = false); }
/** * @param File $file * @param bool $animatedPreview * @param int $width * @param int $height * @param bool $keepAspect * @param bool $base64Encode * * @return array */ private function getPreviewData($file, $animatedPreview, $width, $height, $keepAspect, $base64Encode) { $status = Http::STATUS_OK; if ($this->previewService->isPreviewRequired($file, $animatedPreview)) { $preview = $this->previewService->createPreview($file, $width, $height, $keepAspect, $base64Encode); } else { $preview = $this->downloadService->downloadFile($file, $base64Encode); } if (!$preview) { list($preview, $status) = $this->getErrorData(); } return [$preview, $status]; }