class Thumbnail

Thumbnail Creation Class

Methods

string
generate(mixed $source, $empty_thumb = true)

Generate a Thumb for the passed file and returns the file path to the generated image

bool
generatePreviewsOfDocument(int|DocumentIndex $document_index, bool $force_new = false)

Evaluates the proper thumb doc of a document If the document index does not yet have a thumb_doc property, it is evaluated and saved.

string|false
get_document_thumbnail_url(DocumentIndex|int $document_index, int|bool $width = false, int|bool $height = false, bool $return_empty = true, bool $only_if_cached = true)

Generates the url to a thumbnail of given proportions for a specific document index. Returns false if an error occurred.

string
get_output_mime()

Returns the MIME Type of the generated thumbs

array
get_supported_file_types($type = false)

Get Support File Types

init()

Initialize Thumbnail Engine

set_thumbsize(mixed $w = 100, mixed $h = 100)

Set Thumb Size

Details

at line 94
string generate(mixed $source, $empty_thumb = true)

Generate a Thumb for the passed file and returns the file path to the generated image

Parameters

mixed $source

HDD file path

$empty_thumb

Return Value

string

HDD File path to Cachefile

See also

generate_pdf_thumb
generate_msoffice_thumb
generate_image_thumb
generate_video_thumb

at line 208
bool generatePreviewsOfDocument(int|DocumentIndex $document_index, bool $force_new = false)

Evaluates the proper thumb doc of a document If the document index does not yet have a thumb_doc property, it is evaluated and saved.

The method ALWAYS returns either the filename that is to be ultimatly used for the thumbnail or false in case some kind of error occurred. Even though, the method internally saves reference ids should they be provided by the get_thumb_document of the document model. Returns false if an error occurred.

Parameters

int|DocumentIndex $document_index

The document index object or id for which the thumbnail doc is to be retrieved

bool $force_new

Forces the thumbnails to be generated even if they already exist

Return Value

bool

true if the process created a valid preview, false if an error occurred.

at line 275
string|false get_document_thumbnail_url(DocumentIndex|int $document_index, int|bool $width = false, int|bool $height = false, bool $return_empty = true, bool $only_if_cached = true)

internal  param Reference $xmodel_system_document_index Document Index Model (If you have a reference from this to the original)
 

Generates the url to a thumbnail of given proportions for a specific document index. Returns false if an error occurred.

Parameters

DocumentIndex|int $document_index

The document index object or its id for which the thumbnail is to be retrieved

int|bool $width

The width of the thumbnail (optional)

int|bool $height

The height of the thumbnail (optional)

bool $return_empty

Always Return Image (Transparent/White Image if none is available)

bool $only_if_cached

Should the resize happen in real time?

Return Value

string|false

The url of the thumbnail file

at line 128
string get_output_mime()

Returns the MIME Type of the generated thumbs

Return Value

string

at line 363
array get_supported_file_types($type = false)

Get Support File Types

Parameters

$type

Return Value

array

File Extensions (e.g.)

at line 57
init()

Initialize Thumbnail Engine

at line 78
set_thumbsize(mixed $w = 100, mixed $h = 100)

Set Thumb Size

Parameters

mixed $w
mixed $h