PreviewPublicController

Extends \OCA\Gallery\Controller\PreviewController

Class PreviewPublicController

Note: Type casting only works if the "@param" parameters are also included in this class as their not yet inherited

package

OCA\Gallery\Controller

Methods

Constructor

__construct(string $appName, \OCP\IRequest $request, \OCP\IURLGenerator $urlGenerator, \OCA\Gallery\Service\ConfigService $configService, \OCA\Gallery\Service\ThumbnailService $thumbnailService, \OCA\Gallery\Service\PreviewService $previewService, \OCA\Gallery\Service\DownloadService $downloadService, \OCA\Gallery\Utility\EventSource $eventSource, \OCP\ILogger $logger) 
inherited

Arguments

$appName

string

$request

\OCP\IRequest

$urlGenerator

\OCP\IURLGenerator

$logger

\OCP\ILogger

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

exitController() 
inherited

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>
inherited
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>
inherited

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>
inherited

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>
inherited

Arguments

$fileId

integer

Response

\OCA\Gallery\Controller\array

getPreview

getPreview(integer $fileId, integer $width, integer $height) : \OCA\Gallery\Http\ImageResponse|\OCP\AppFramework\Http\JSONResponse
inherited
NoAdminRequired

Sends either a large preview of the requested file or the original file itself

Arguments

$fileId

integer

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

$width

integer

$height

integer

Response

\OCA\Gallery\Http\ImageResponse|\OCP\AppFramework\Http\JSONResponse

getPreviewData

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

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>
inherited

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

getThumbnails

getThumbnails(string $ids, boolean $square, double $scale) : \OCA\Gallery\Controller\array<string,array|string|\OCA\Gallery\Controller\null>
inherited
NoAdminRequired

Generates thumbnails

Uses EventSource to send thumbnails back as soon as they're created

FIXME: @LukasReschke says: The exit is required here because otherwise the AppFramework is trying to add headers as well after dispatching the request which results in a "Cannot modify header information" notice.

WARNING: Returning a JSON response does not get rid of the problem

Arguments

$ids

string

the ID of the files of which we need thumbnail previews of

$square

boolean

$scale

double

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>
inherited

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

eventSource

eventSource : \OCA\Gallery\Utility\EventSource
inherited

urlGenerator

urlGenerator : \OCP\IURLGenerator
inherited
var

Type(s)

\OCP\IURLGenerator

configService

configService : \OCA\Gallery\Service\ConfigService
inherited

thumbnailService

thumbnailService : \OCA\Gallery\Service\ThumbnailService
inherited

previewService

previewService : \OCA\Gallery\Service\PreviewService
inherited

downloadService

downloadService : \OCA\Gallery\Service\DownloadService
inherited

logger

logger : \OCP\ILogger
inherited
var

Type(s)

\OCP\ILogger

download

download : 
inherited
type

bool

Type(s)