PHP Class Thumb

Show file Open project: getkirby/toolkit Class Usage Examples

Public Properties

Property Type Description
$defaults
$destination
$drivers
$error
$options
$result
$source

Public Methods

Method Description
__call ( string $method, mixed $arguments ) : mixed Makes all public methods of the result object available to the thumb class
__construct ( mixed $source, array $params = [] ) Constructor
__toString ( ) Makes it possible to echo the entire object
destination ( ) : Obj Build the destination object
error ( ) : Exception Returns the exception if available
isObsolete ( ) : boolean Checks if the thumbnail is not needed because the original image is small enough
isThere ( ) : boolean Checks if the thumbnail already exists and is newer than the original file
params ( array $params ) : array Makes it possible to pass a string of params which is shorter and more convenient than passing a full array of keys and values: width:300|height:200|crop:true
settingsIdentifier ( ) : string Builds a hash for all relevant settings
source ( ) : Media Returns the source media object
tag ( array $attr = [] ) : string Generates and returns the full html tag for the thumbnail

Protected Methods

Method Description
create ( ) Calls the driver function and creates the thumbnail

Method Details

__call() public method

Makes all public methods of the result object available to the thumb class
public __call ( string $method, mixed $arguments ) : mixed
$method string
$arguments mixed
return mixed

__construct() public method

Constructor
public __construct ( mixed $source, array $params = [] )
$source mixed
$params array

__toString() public method

Makes it possible to echo the entire object
public __toString ( )

create() protected method

Calls the driver function and creates the thumbnail
protected create ( )

destination() public method

Build the destination object
public destination ( ) : Obj
return Obj

error() public method

Returns the exception if available
public error ( ) : Exception
return Exception

isObsolete() public method

Checks if the thumbnail is not needed because the original image is small enough
public isObsolete ( ) : boolean
return boolean

isThere() public method

Checks if the thumbnail already exists and is newer than the original file
public isThere ( ) : boolean
return boolean

params() public method

Makes it possible to pass a string of params which is shorter and more convenient than passing a full array of keys and values: width:300|height:200|crop:true
public params ( array $params ) : array
$params array
return array

settingsIdentifier() public method

Builds a hash for all relevant settings
public settingsIdentifier ( ) : string
return string

source() public method

Returns the source media object
public source ( ) : Media
return Media

tag() public method

Generates and returns the full html tag for the thumbnail
public tag ( array $attr = [] ) : string
$attr array An optional array of attributes, which should be added to the image tag
return string

Property Details

$defaults public static property

public static $defaults

$destination public property

public $destination

$drivers public static property

public static $drivers

$error public property

public $error

$options public property

public $options

$result public property

public $result

$source public property

public $source