IPreview¶
-
interface
OCP\
IPreview
¶ - This class provides functions to render and show thumbnails and previews of files
Implemented by: OC\PreviewManager
Source: lib/public/IPreview.php#47
Constants¶
-
EVENT = self::class . : . PreviewRequested
Source: lib/public/IPreview.php#53 Since: 9.2.0 Deprecated: 22.0.0
-
MODE_FILL = fill
Source: lib/public/IPreview.php#55
-
MODE_COVER = cover
Source: lib/public/IPreview.php#56
Methods¶
-
public
OCP\IPreview::
registerProvider
($mimeTypeRegex, $callable)¶ - In order to improve lazy loading a closure can be registered which will becalled in case preview providers are actually requested$callable has to return an instance of \OCP\Preview\IProvider
Source: Parameters: - $mimeTypeRegex (string) Regex with the mime types that are supported by this provider
- $callable (
Closure
)
Returns: void
Since: 8.1.0
-
public
OCP\IPreview::
getProviders
()¶ - Get all providers
Source: lib/public/IPreview.php#76 Returns: array Since: 8.1.0
-
public
OCP\IPreview::
hasProviders
()¶ - Does the manager have any providers
Source: lib/public/IPreview.php#83 Returns: bool Since: 8.1.0
-
public
OCP\IPreview::
getPreview
($file, $width=-1, $height=-1, $crop=false, $mode=\OCP\IPreview::MODE_FILL, $mimeType=null)¶ - Returns a preview of a fileThe cache is searched first and if nothing usable was found then a preview isgenerated by one of the providers
Source: Parameters: - $file (
OCP\Files\File
) - $width (int)
- $height (int)
- $crop (bool)
- $mode (string)
- $mimeType (string) To force a given mimetype for the file (files_versions needs this)
Returns: Throws: Throws: \InvalidArgumentException
if the preview would be invalid (in case the original image is invalid)Throws: Throws: \InvalidArgumentException
if the preview would be invalid (in case the original image is invalid)Since: 11.0.0 - \InvalidArgumentException was added in 12.0.0
- $file (
-
public
OCP\IPreview::
isMimeSupported
($mimeType=*)¶ - Returns true if the passed mime type is supported
Source: Parameters: - $mimeType (string)
Returns: bool
Since: 6.0.0
-
public
OCP\IPreview::
isAvailable
($file)¶ - Check if a preview can be generated for a file
Source: Parameters: - $file (
OCP\Files\FileInfo
)
Returns: bool
Since: 8.0.0
- $file (
-
public
OCP\IPreview::
generatePreviews
($file, $specifications, $mimeType=null)¶ - Generates previews of a file
Source: Parameters: - $file (
OCP\Files\File
) - $specifications (array)
- $mimeType (string)
Returns: \OCP\Files\SimpleFS\ISimpleFile
the last preview that was generatedThrows: Throws: \InvalidArgumentException
if the preview would be invalid (in case the original image is invalid)Throws: Throws: \InvalidArgumentException
if the preview would be invalid (in case the original image is invalid)Since: 19.0.0
- $file (