PHP 클래스 Elgg\ImageService

부터: 2.3
파일 보기 프로젝트 열기: elgg/elgg

공개 메소드들

메소드 설명
__construct ( Imagine\Image\ImagineInterface $imagine, Config $config ) Constructor
normalizeResizeParameters ( integer $width, integer $height, array $params = [] ) : array Calculate the parameters for resizing an image
resize ( string $source, string $destination = null, array $params = [] ) : boolean Crop and resize an image

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( Imagine\Image\ImagineInterface $imagine, Config $config )
$imagine Imagine\Image\ImagineInterface Imagine interface
$config Config Elgg config

normalizeResizeParameters() 공개 메소드

Calculate the parameters for resizing an image
public normalizeResizeParameters ( integer $width, integer $height, array $params = [] ) : array
$width integer Natural width of the image
$height integer Natural height of the image
$params array Resize parameters - 'w' maximum width of the resized image - 'h' maximum height of the resized image - 'upscale' allow upscaling - 'square' constrain to a square - 'x1', 'y1', 'x2', 'y2' cropping coordinates
리턴 array

resize() 공개 메소드

Crop and resize an image
public resize ( string $source, string $destination = null, array $params = [] ) : boolean
$source string Path to source image
$destination string Path to destination If not set, will modify the source image
$params array An array of cropping/resizing parameters - INT 'w' represents the width of the new image With upscaling disabled, this is the maximum width of the new image (in case the source image is smaller than the expected width) - INT 'h' represents the height of the new image With upscaling disabled, this is the maximum height - INT 'x1', 'y1', 'x2', 'y2' represent optional cropping coordinates. The source image will first be cropped to these coordinates, and then resized to match width/height parameters - BOOL 'square' - square images will fill the bounding box (width x height). In Imagine's terms, this equates to OUTBOUND mode - BOOL 'upscale' - if enabled, smaller images will be upscaled to fit the bounding box.
리턴 boolean