\Intervention\ImageSize

Summary

Methods
Properties
Constants
__construct()
set()
setPivot()
getWidth()
getHeight()
getRatio()
resize()
relativePosition()
fit()
fitsInto()
align()
$width
$height
$pivot
No constants found
No protected methods found
No protected properties found
N/A
resizeWidth()
resizeHeight()
getConstraint()
No private properties found
N/A

Properties

$width

$width : int

Width

Type

int

$height

$height : int

Height

Type

int

$pivot

$pivot : \Intervention\Image\Point

Pivot point

Type

Point

Methods

__construct()

__construct(int  $width = null, int  $height = null, \Intervention\Image\Point  $pivot = null) : mixed

Creates a new Size instance

Parameters

int $width
int $height
\Intervention\Image\Point $pivot

Returns

mixed —

set()

set(int  $width, int  $height) : mixed

Set the width and height absolutely

Parameters

int $width
int $height

Returns

mixed —

setPivot()

setPivot(\Intervention\Image\Point  $point) : mixed

Set current pivot point

Parameters

\Intervention\Image\Point $point

Returns

mixed —

getWidth()

getWidth() : int

Get the current width

Returns

int —

getHeight()

getHeight() : int

Get the current height

Returns

int —

getRatio()

getRatio() : float

Calculate the current aspect ratio

Returns

float —

resize()

resize(int  $width, int  $height, \Closure  $callback = null) : \Intervention\Image\Size

Resize to desired width and/or height

Parameters

int $width
int $height
\Closure $callback

Returns

\Intervention\Image\Size —

relativePosition()

relativePosition(\Intervention\Image\Size  $size) : \Intervention\Image\Point

Calculate the relative position to another Size based on the pivot point settings of both sizes.

Parameters

\Intervention\Image\Size $size

Returns

\Intervention\Image\Point —

fit()

fit(\Intervention\Image\Size  $size, mixed  $position = 'center') : \Intervention\Image\Size

Resize given Size to best fitting size of current size.

Parameters

\Intervention\Image\Size $size
mixed $position

Returns

\Intervention\Image\Size —

fitsInto()

fitsInto(\Intervention\Image\Size  $size) : bool

Checks if given size fits into current size

Parameters

\Intervention\Image\Size $size

Returns

bool —

align()

align(string  $position, int  $offset_x, int  $offset_y) : \Intervention\Image\Size

Aligns current size's pivot point to given position and moves point automatically by offset.

Parameters

string $position
int $offset_x
int $offset_y

Returns

\Intervention\Image\Size —

resizeWidth()

resizeWidth(int  $width, \Closure  $callback = null) : \Intervention\Image\Size

Scale size according to given constraints

Parameters

int $width
\Closure $callback

Returns

\Intervention\Image\Size —

resizeHeight()

resizeHeight(int  $height, \Closure  $callback = null) : \Intervention\Image\Size

Scale size according to given constraints

Parameters

int $height
\Closure $callback

Returns

\Intervention\Image\Size —

getConstraint()

getConstraint(\Closure  $callback = null) : \Intervention\Image\Constraint

Runs constraints on current size

Parameters

\Closure $callback

Returns

\Intervention\Image\Constraint —