class ThumbnailGenerator (View source)

Generate thumbnails and thumbnail links

Traits

Provides extensions to this object to integrate it with standard config API methods.

Constants

INLINE

Thumbnails are inline

URL

Thumbnails are linked by url

Config options

max_thumbnail_bytes int

Safely limit max inline thumbnail size to 200kb.

method string

Properties

protected bool $generates

Set to false to not generate

Methods

public static 
config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

public
mixed
uninherited(string $name)

Gets the uninherited value for the given config option

public
string|null
generateThumbnailLink(AssetContainer $file, int $width, int $height, bool $graceful = false)

Generate thumbnail and return the "src" property for this thumbnail

public
generateThumbnail(AssetContainer $file, int $width, int $height)

Generate thumbnail object

public
string
generateLink(AssetContainer $thumbnail = null)

Generate "src" property for this thumbnail.

public
bool
getGenerates()

No description

public
$this
setGenerates(bool $generates)

No description

Details

static Config_ForClass config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

Return Value

Config_ForClass

mixed uninherited(string $name)

Gets the uninherited value for the given config option

Parameters

string $name

Return Value

mixed

Generate thumbnail and return the "src" property for this thumbnail

Parameters

AssetContainer $file
int $width
int $height
bool $graceful

If true, null result will fallback on URL

Return Value

string|null

AssetContainer|DBFile|File generateThumbnail(AssetContainer $file, int $width, int $height)

Generate thumbnail object

Parameters

AssetContainer $file
int $width
int $height

Return Value

AssetContainer|DBFile|File

Generate "src" property for this thumbnail.

This can be either a url or base64 encoded data

Parameters

AssetContainer $thumbnail

Return Value

string

bool getGenerates()

No description

Return Value

bool

$this setGenerates(bool $generates)

No description

Parameters

bool $generates

Return Value

$this