Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • AdjustThumbnailOptions
  • AdjustThumbnailVersion
  • CacheManager
  • GetOperation
  • Hooks
  • Module
  • PopThumbnailVersion
  • Thumbnail
  • Version
  • Versions

Exceptions

  • VersionNotDefined

Constants

  • CACHE_VERSIONS

Class Thumbnail

Representation of an image thumbnail.

Instances of the class are used to create IMG elements. The parameters used to create the thumbnail can be specified as a serialized string, an array of options, a version name, or a version instance.

ICanBoogie\Object implements ICanBoogie\ToArrayRecursive uses ICanBoogie\ToArrayRecursiveTrait, ICanBoogie\PrototypeTrait
Extended by ICanBoogie\Modules\Thumbnailer\Thumbnail

Direct known subclasses

Icybee\Modules\Images\Thumbnail

Namespace: ICanBoogie\Modules\Thumbnailer
Located at vendor/icanboogie-modules/thumbnailer/lib/thumbnail.php

Methods summary

public static string|null
# format_options_as_path( array $options )

Format the specified options as a path.

Format the specified options as a path.

Only the width, height, method and format options are used to create the path.

If it is not defined, the method option is inferred from the width and height options. For instance, If the width option is defined but the height option is empty, the method option is set to fixed-width. Similarly, if the height option is defined but the width option is empty, the method option is set to fixed-height.

The format option is used as the extension of the path. e.g. "200x300.png".

Parameters

$options
array
$options

Returns

string|null
A path, or null if both width and height are empty.
public static string
# format_options_as_query_string( array $options, boolean $remove_path_params = false )

Formats the options as a query string.

Formats the options as a query string.

Parameters

$options
array
$options The options to format. They are filtered using ICanBoogie\Modules\Thumbnailer\Version::filter().
$remove_path_params
boolean
$remove_path_params Optionally the options that can be used to format a path using the ICanBoogie\Modules\Thumbnailer\Thumbnail::format_options_as_path() function can be filtered out.

Returns

string
A query string. Note that the option that are actually used to create the query string are shortened using the ICanBoogie\Modules\Thumbnailer\Version::shorten() method.
public
# __construct( Icybee\Modules\Images\Image|integer|string $src, string|array $options = null, string|array $additionnal_options = null )

Constructor.

Constructor.

Parameters

$src
Icybee\Modules\Images\Image|integer|string
The souce of the thumbnail.
$options
string|array
$options The options to create the thumbnail can be provided as a version name or an array of options. If a version name is provided, the image parameter must also be provided.
$additionnal_options
string|array
$additionnal_options Additionnal options to create the thumbnail.
public mixed
# __get( string $property )

Handles version options.

Handles version options.

Parameters

$property
string
$property

Returns

mixed
The value of the inaccessible property.

Throws

PropertyNotReadable
when the property has a protected or private scope and no suitable callback could be found to retrieve its value.
PropertyNotDefined
when the property is undefined and there is no suitable callback to retrieve its values.

Overrides

ICanBoogie\Object::__get
public
# __set( string $property, mixed $value )

Handles version options.

Handles version options.

Parameters

$property
string
$property
$value
mixed
$value

Throws

PropertyNotWritable
if the property is not writable.

Overrides

ICanBoogie\Object::__set
protected
# get_version( )
protected array
# get_filtered_options( )

Returns the options, filtered.

Returns the options, filtered.

Returns

array
protected string
# get_url( )

Returns the thumbnail URL.

Returns the thumbnail URL.

Returns

string
The thumbnail URL.
protected string
# get_url_base( )

Returns a base to build the thumbnail's URL.

Returns a base to build the thumbnail's URL.

Returns

string
protected
# get_final_size( )

Returns the final size (width and height) of the thumbnail.

Returns the final size (width and height) of the thumbnail.

public Brickrouge\Element
# to_element( array $attributes = [] )

Convert the thumbnail into a IMG element.

Convert the thumbnail into a IMG element.

The width and height attribute of the element are defined whenever possible. The alt attribute is also defined if the image src is an Image active record.

Parameters

$attributes
array
$attributes Additionnal attributes to create the Brickrouge\Element instance.

Returns

Brickrouge\Element
public
# __toString( )

Return a IMG element that can be inserted as is in the document.

Return a IMG element that can be inserted as is in the document.

Methods inherited from ICanBoogie\Object

from(), resolve_facade_properties(), resolve_private_properties(), to_array(), to_json()

Methods inherited from ICanBoogie\ToArrayRecursive

to_array_recursive()

Methods used from ICanBoogie\ToArrayRecursiveTrait

to_array_recursive()

Methods used from ICanBoogie\PrototypeTrait

__call(), __sleep(), __wakeup(), get_prototype(), has_method(), has_property(), last_chance_get(), last_chance_set()

Magic methods summary

Properties summary

public ICanBoogie\ActiveRecord|integer|string $src
#

The source of the thumbnail.

The source of the thumbnail.

public array $options
#

Options to create the thumbnail.

Options to create the thumbnail.

protected string $version_name
#

Version name of the thumbnail.

Version name of the thumbnail.

Magic properties

public mixed $width
#

int|null Width of the thumbnail, or null if it is not defined.

int|null Width of the thumbnail, or null if it is not defined.

public mixed $height
#

int|null Height of the thumbnail, or nullif it is not defined.

int|null Height of the thumbnail, or nullif it is not defined.

public mixed $method
#

string|null Resizing method, or null if it is not defined.

string|null Resizing method, or null if it is not defined.

public mixed $format
#

string|null Image format, or null if it is not defined.

string|null Image format, or null if it is not defined.

public mixed $version
#

Version|null The ICanBoogie\Modules\Thumbnailer\Version instance used to created the thumbnail, or null if it is not defined.

Version|null The ICanBoogie\Modules\Thumbnailer\Version instance used to created the thumbnail, or null if it is not defined.

public mixed $w
#

int|null Alias to $width.

int|null Alias to $width.

public mixed $h
#

int|null Alias to $height.

int|null Alias to $height.

public mixed $m
#

string|null Alias to $method.

string|null Alias to $method.

public mixed $f
#

string|null Alias to $format.

string|null Alias to $format.

public mixed $v
#

Version|null Alias to $version.

Version|null Alias to $version.

public array $options
#

Options used to create the thumbnail.

Options used to create the thumbnail.

public read-only array $filtered_options
#

Filtered thumbnail options.

Filtered thumbnail options.

public read-only string $url
#

The URL of the thumbnail.

The URL of the thumbnail.

public read-only string $url_base
#

The base to build the URL of the thumbnail.

The base to build the URL of the thumbnail.

public read-only array $final_size
#

The final size (width and height) of the thumbnail.

The final size (width and height) of the thumbnail.

Magic properties inherited from ICanBoogie\Object

$prototype

Autodoc API documentation generated by ApiGen 2.8.0