Cheetah
Public Member Functions | Public Attributes | List of all members
Intervention\Image\Size Class Reference

Public Member Functions

 __construct ($width=null, $height=null, Point $pivot=null)
 
 set ($width, $height)
 
 setPivot (Point $point)
 
 getWidth ()
 
 getHeight ()
 
 getRatio ()
 
 resize ($width, $height, Closure $callback=null)
 
 relativePosition (Size $size)
 
 fit (Size $size, $position='center')
 
 fitsInto (Size $size)
 
 align ($position, $offset_x=0, $offset_y=0)
 

Public Attributes

 $width
 
 $height
 
 $pivot
 

Detailed Description

Definition at line 7 of file Size.php.

Constructor & Destructor Documentation

◆ __construct()

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

Creates a new Size instance

Parameters
integer$width
integer$height
Point$pivot

Definition at line 37 of file Size.php.

Member Function Documentation

◆ align()

Intervention\Image\Size::align (   $position,
  $offset_x = 0,
  $offset_y = 0 
)

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

Parameters
string$position
integer$offset_x
integer$offset_y
Returns
\Intervention\Image\Size

Definition at line 278 of file Size.php.

◆ fit()

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

Resize given Size to best fitting size of current size.

Parameters
Size$size
Returns
\Intervention\Image\Size

Definition at line 225 of file Size.php.

◆ fitsInto()

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

Checks if given size fits into current size

Parameters
Size$size
Returns
boolean

Definition at line 264 of file Size.php.

◆ getHeight()

Intervention\Image\Size::getHeight ( )

Get the current height

Returns
integer

Definition at line 81 of file Size.php.

◆ getRatio()

Intervention\Image\Size::getRatio ( )

Calculate the current aspect ratio

Returns
float

Definition at line 91 of file Size.php.

◆ getWidth()

Intervention\Image\Size::getWidth ( )

Get the current width

Returns
integer

Definition at line 71 of file Size.php.

◆ relativePosition()

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

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

Parameters
Size$size
Returns
\Intervention\Image\Point

Definition at line 211 of file Size.php.

◆ resize()

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

Resize to desired width and/or height

Parameters
integer$width
integer$height
Closure$callback
Returns
Size

Definition at line 104 of file Size.php.

◆ set()

Intervention\Image\Size::set (   $width,
  $height 
)

Set the width and height absolutely

Parameters
integer$width
integer$height

Definition at line 50 of file Size.php.

◆ setPivot()

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

Set current pivot point

Parameters
Point$point

Definition at line 61 of file Size.php.

Member Data Documentation

◆ $height

Intervention\Image\Size::$height

Definition at line 21 of file Size.php.

◆ $pivot

Intervention\Image\Size::$pivot

Definition at line 28 of file Size.php.

◆ $width

Intervention\Image\Size::$width

Definition at line 14 of file Size.php.


The documentation for this class was generated from the following file: