Preview

Generates previews

todo

On OC9, replace \OC\Preview with IPreview if methods we need have been added

package

OCA\Gallery\Preview

Methods

Constructor

__construct(\OCP\IConfig $config, \OCP\IPreview $previewManager, \OCP\ILogger $logger) 

Arguments

$config

\OCP\IConfig

$previewManager

\OCP\IPreview

$logger

\OCP\ILogger

Asks core for a preview based on our criteria

getPreviewFromCore(boolean $keepAspect) : \OC_Image
todo

Need to read scaling setting from settings

Arguments

$keepAspect

boolean

Response

\OC_Image

Returns true if the passed mime type is supported

isMimeSupported(string $mimeType = '*') : boolean

Arguments

$mimeType

string

Response

boolean

Returns a preview based on OC's preview class and our custom methods

preparePreview(integer $maxWidth, integer $maxHeight, boolean $keepAspect) : \OCA\Gallery\Preview\array<string,string|\OC_Image>|false

We check that the preview returned by the Preview class can be used by the browser. If not, we send "false" to the controller

fixme

setKeepAspect is missing from public interface. https://github.com/owncloud/core/issues/12772

Arguments

$maxWidth

integer

$maxHeight

integer

$keepAspect

boolean

Response

\OCA\Gallery\Preview\array|false

Initialises the view which will be used to access files and generate previews

setupView(string $userId, \OCP\Files\File $file, string $imagePathFromFolder) 
fixme

Private API, but can't use the PreviewManager yet as it's incomplete

Arguments

$userId

string

$file

\OCP\Files\File

$imagePathFromFolder

string

Properties

dataDir

dataDir : string
var

Type(s)

string

previewManager

previewManager : mixed
var

Type(s)

mixed

logger

logger : \OCP\ILogger
var

Type(s)

\OCP\ILogger

userId

userId : string
var

Type(s)

string

preview

preview : \OC\Preview
var

Type(s)

\OC\Preview

file

file : \OCP\Files\File
var

Type(s)

\OCP\Files\File

dims

dims : array<mixed,integer>
var

Type(s)

array<mixed,integer>