Preview

Class Preview

package

OCA\Gallery\Controller

Methods

Exits the controller in a live environment and throws an exception when testing

exitController() 

Returns either a generated preview, the file as-is or an empty object

getData(integer $fileId, integer $width, integer $height, boolean $keepAspect = true, boolean $animatedPreview = true, boolean $base64Encode = false) : \OCA\Gallery\Controller\array<string,\OC_Image|\OCA\Gallery\Controller\string>
Throws
\OCA\Gallery\Service\NotFoundServiceException

Arguments

$fileId

integer

$width

integer

$height

integer

$keepAspect

boolean

$animatedPreview

boolean

$base64Encode

boolean

Response

\OCA\Gallery\Controller\array

Returns an error array

getErrorData( $status = \OCP\AppFramework\Http::STATUS_INTERNAL_SERVER_ERROR) : \OCA\Gallery\Controller\array<null|\OCA\Gallery\Controller\int>

Arguments

$status

Response

\OCA\Gallery\Controller\array

Returns an error array

getExceptionData(\OCA\Gallery\Service\ServiceException $exception) : \OCA\Gallery\Controller\array<null|integer|\OCA\Gallery\Controller\string>

Arguments

Response

\OCA\Gallery\Controller\array

Returns the file of which a preview will be generated

getFile(integer $fileId) : \OCA\Gallery\Controller\array<File|integer|\OCA\Gallery\Controller\null>

Arguments

$fileId

integer

Response

\OCA\Gallery\Controller\array

getPreviewData

getPreviewData(\OCP\Files\File $file, boolean $animatedPreview, integer $width, integer $height, boolean $keepAspect, boolean $base64Encode) : array

Arguments

$file

\OCP\Files\File

$animatedPreview

boolean

$width

integer

$height

integer

$keepAspect

boolean

$base64Encode

boolean

Response

array

Retrieves the thumbnail to send back to the browser

getThumbnail(integer $fileId, boolean $square, double $scale) : \OCA\Gallery\Controller\array<string,array|\OCA\Gallery\Controller\string>

The thumbnail is either a resized preview of the file or the original file Thumbnails are base64encoded before getting sent back

Arguments

$fileId

integer

the ID of the file of which we need a thumbnail preview of

$square

boolean

whether the thumbnail should be square

$scale

double

whether we're allowed to scale the preview up

Response

\OCA\Gallery\Controller\array

Prepares an empty Thumbnail array to send back

prepareEmptyThumbnail(\OCP\Files\File $file, integer $status) : \OCA\Gallery\Controller\array<string,null|\OCA\Gallery\Controller\string>

When we can't even get the file information, we send an empty mimeType

Arguments

$file

\OCP\Files\File

$status

integer

Response

\OCA\Gallery\Controller\array

Properties

urlGenerator

urlGenerator : \OCP\IURLGenerator
var

Type(s)

\OCP\IURLGenerator

configService

configService : \OCA\Gallery\Service\ConfigService

thumbnailService

thumbnailService : \OCA\Gallery\Service\ThumbnailService

previewService

previewService : \OCA\Gallery\Service\PreviewService

downloadService

downloadService : \OCA\Gallery\Service\DownloadService

logger

logger : \OCP\ILogger
var

Type(s)

\OCP\ILogger

download

download : 
type

bool

Type(s)