PHP Class Thumbor\Url\CommandSet

显示文件 Open project: 99designs/phumbor Class Usage Examples

Public Methods

Method Description
addFilter ( ) Append a filter, e.g. ->addFilter('brightness', 42)
crop ( $topLeftX, $topLeftY, $bottomRightX, $bottomRightY ) Manually specify crop window.
fitIn ( $width, $height ) Resize the image to fit in a box of the specified dimensions. Overrides any previous call to fullFitIn, fitIn or resize.
fullFitIn ( $width, $height ) Resize the image to fit by smallest side in a box of the specified dimensions.
halign ( string $halign ) Specify horizontal alignment used if width is altered due to cropping
metadataOnly ( boolean $metadataOnly ) Specify that JSON metadata should be returned instead of the thumbnailed image.
resize ( $width, $height ) Resize the image to the specified dimensions. Overrides any previous call to fullFitIn, fitIn or resize.
smartCrop ( boolean $smartCrop ) Specify that smart cropping should be used (overrides halign/valign).
toArray ( ) Stringify and return commands as an array.
trim ( $colourSource = null, $tolerance = null ) Trim surrounding space from the thumbnail. The top-left corner of the image is assumed to contain the background colour. To specify otherwise, pass either 'top-left' or 'bottom-right' as the $colourSource argument.
valign ( string $valign ) Specify vertical alignment used if height is altered due to cropping

Method Details

addFilter() public method

Append a filter, e.g. ->addFilter('brightness', 42)
public addFilter ( )

crop() public method

Manually specify crop window.
public crop ( $topLeftX, $topLeftY, $bottomRightX, $bottomRightY )

fitIn() public method

Resize the image to fit in a box of the specified dimensions. Overrides any previous call to fullFitIn, fitIn or resize.
public fitIn ( $width, $height )

fullFitIn() public method

Overrides any previous call to fullFitIn, fitIn or resize.
public fullFitIn ( $width, $height )

halign() public method

Specify horizontal alignment used if width is altered due to cropping
public halign ( string $halign )
$halign string one of {'left', 'center', 'right'}

metadataOnly() public method

Specify that JSON metadata should be returned instead of the thumbnailed image.
public metadataOnly ( boolean $metadataOnly )
$metadataOnly boolean

resize() public method

Use a value of 0 for proportional resizing. E.g. for a 640 x 480 image, ->size(320, 0) yields a 320 x 240 thumbnail. Use a value of 'orig' to use an original image dimension. E.g. for a 640 x 480 image, ->resize(320, 'orig') yields a 320 x 480 thumbnail.
public resize ( $width, $height )

smartCrop() public method

Specify that smart cropping should be used (overrides halign/valign).
public smartCrop ( boolean $smartCrop )
$smartCrop boolean

toArray() public method

Stringify and return commands as an array.
public toArray ( )

trim() public method

For tolerance the euclidian distance between the colors of the reference pixel and the surrounding pixels is used. If the distance is within the tolerance they'll get trimmed. For a RGB image the tolerance would be within the range 0-442
public trim ( $colourSource = null, $tolerance = null )

valign() public method

Specify vertical alignment used if height is altered due to cropping
public valign ( string $valign )
$valign string one of {'top', 'middle', 'bottom'}