class Creator implements CreatorInterface (View source)

Creates thumbnails.

Properties

protected Imagine $svgImagine
protected bool $limitUpscaling
protected Color $background

Methods

__construct(bool $limitUpscaling = true, Imagine $svgImagine = null, Color $background = null)

Creator constructor.

string
create(Transaction $transaction)

Creates a thumbnail for the given transaction.

verifyInfo(Transaction $transaction)

Verifies that the image's info can be read correctly.

autoscale(Transaction $transaction)

If target width and/or height are set to 0, they are set based on the image's height/width.

checkForUpscale(Transaction $transaction)

Limits the target width/height to the image's height/width if upscale is not allowed.

string
resize(Transaction $transaction)

Do the actual resize/crop/fit/border logic and return the image data.

string
resizeSvg(Transaction $transaction)

Resize SVG image.

Details

__construct(bool $limitUpscaling = true, Imagine $svgImagine = null, Color $background = null)

Creator constructor.

Parameters

bool $limitUpscaling
Imagine $svgImagine
Color $background

string create(Transaction $transaction)

Creates a thumbnail for the given transaction.

Parameters

Transaction $transaction

Return Value

string thumbnail data

protected verifyInfo(Transaction $transaction)

Verifies that the image's info can be read correctly.

If the src image fails, it tries the error image as the fallback.

Parameters

Transaction $transaction

Exceptions

RuntimeException If both src and error images fail to be read.

protected autoscale(Transaction $transaction)

If target width and/or height are set to 0, they are set based on the image's height/width.

Parameters

Transaction $transaction

protected checkForUpscale(Transaction $transaction)

Limits the target width/height to the image's height/width if upscale is not allowed.

Parameters

Transaction $transaction

protected string resize(Transaction $transaction)

Do the actual resize/crop/fit/border logic and return the image data.

Parameters

Transaction $transaction

Return Value

string

protected string resizeSvg(Transaction $transaction)

Resize SVG image.

Parameters

Transaction $transaction

Return Value

string