PHP Class Bkwld\Croppa\Image

Show file Open project: bkwld/croppa Class Usage Examples

Public Methods

Method Description
__construct ( string $data, array $options = [] ) Constructor
applyFilters ( $options ) Apply filters that have been defined in the config as seperate classes.
autoRotate ( ) Auto rotate the image based on exif data (like from phones) https://github.com/nik-kor/PHPThumb/blob/master/src/thumb_plugins/jpg_rotate.inc.php
crop ( integer $width, integer $height ) Resize and crop
cropQuadrant ( integer $width, integer $height, array $options ) Do a quadrant adaptive resize. Supported quadrant values are: +---+---+---+ | | T | | +---+---+---+ | L | C | R | +---+---+---+ | | B | | +---+---+---+
get ( ) : string Get the image data
pad ( integer $width, integer $height, array $options ) Pad an image to desired dimensions. Moves the image into the center and fills the rest with given color.
process ( integer $width = null, integer $height = null, array $options = [] ) Take the input from the URL and apply transformations on the image
resize ( integer $width, integer $height ) Resize with no cropping
resizeAndOrCrop ( integer $width, integer $height, array $options ) Determine which resize and crop to apply
trim ( array $options ) Determine which trim to apply.
trimPerc ( array $coords ) Trim the source before applying the crop with offset percentages
trimPixels ( array $coords ) Trim the source before applying the crop with as offset pixels

Method Details

__construct() public method

Constructor
public __construct ( string $data, array $options = [] )
$data string Image data as a string
$options array PHPThumb options

applyFilters() public method

Apply filters that have been defined in the config as seperate classes.
public applyFilters ( $options )

autoRotate() public method

Auto rotate the image based on exif data (like from phones) https://github.com/nik-kor/PHPThumb/blob/master/src/thumb_plugins/jpg_rotate.inc.php
public autoRotate ( )

crop() public method

Resize and crop
public crop ( integer $width, integer $height )
$width integer
$height integer

cropQuadrant() public method

Do a quadrant adaptive resize. Supported quadrant values are: +---+---+---+ | | T | | +---+---+---+ | L | C | R | +---+---+---+ | | B | | +---+---+---+
public cropQuadrant ( integer $width, integer $height, array $options )
$width integer
$height integer
$options array

get() public method

Get the image data
public get ( ) : string
return string Image data

pad() public method

Pad an image to desired dimensions. Moves the image into the center and fills the rest with given color.
public pad ( integer $width, integer $height, array $options )
$width integer
$height integer
$options array

process() public method

Take the input from the URL and apply transformations on the image
public process ( integer $width = null, integer $height = null, array $options = [] )
$width integer
$height integer
$options array

resize() public method

Resize with no cropping
public resize ( integer $width, integer $height )
$width integer
$height integer

resizeAndOrCrop() public method

Determine which resize and crop to apply
public resizeAndOrCrop ( integer $width, integer $height, array $options )
$width integer
$height integer
$options array

trim() public method

Determine which trim to apply.
public trim ( array $options )
$options array

trimPerc() public method

Trim the source before applying the crop with offset percentages
public trimPerc ( array $coords )
$coords array Cropping instructions as percentages

trimPixels() public method

Trim the source before applying the crop with as offset pixels
public trimPixels ( array $coords )
$coords array Cropping instructions as pixels