Property | Type | Description | |
---|---|---|---|
$fileObj | contao\File | The File instance of the original image | |
$forceOverride | boolean | Override an existing target | |
$importantPart | array | Important part settings | |
$resizeMode | string | The resize mode (defaults to crop for BC) | |
$resizedPath | string | The resized image path | |
$targetHeight | integer | The target height | |
$targetPath | string | The target path | |
$targetWidth | integer | The target width | |
$zoomLevel | integer | Zoom level (between 0 and 100) |
Method | Description | |
---|---|---|
__construct ( contao\File $file ) | Create a new object to handle an image | |
computeResize ( ) : array | Calculate the resize coordinates | |
create ( string | contao\File $image, array | integer $size = null ) : static | Create an image instance from the given image path and size | |
executeResize ( ) | Resize the image | |
get ( string $image, integer $width, integer $height, string $mode = '', string $target = null, boolean $force = false ) : string | null | Resize an image and store the resized version in the image target folder | |
getCacheName ( ) : string | Get the cache name | |
getForceOverride ( ) : boolean | Get force override setting | |
getHtml ( string $src, string $alt = '', string $attributes = '' ) : string | Generate an image tag and return it as string | |
getImportantPart ( ) : array | Get the important part settings | |
getOriginalPath ( ) : string | Get the path of the original image | |
getPath ( string $src ) : string | Get the relative path to an image | |
getPixelValue ( string $size ) : integer | Convert sizes like 2em, 10cm or 12pt to pixels | |
getResizeMode ( ) : string | Get the resize mode | |
getResizedPath ( ) : string | Get the path of the resized image | |
getTargetHeight ( ) : integer | Get the target height | |
getTargetPath ( ) : string | Get the target path | |
getTargetWidth ( ) : integer | Get the target width | |
getZoomLevel ( ) : integer | Get the zoom level | |
resize ( string $image, integer $width, integer $height, string $mode = '' ) : boolean | Resize or crop an image and replace the original with the resized version | |
setForceOverride ( boolean $forceOverride ) | Override the target image | |
setImportantPart ( array $importantPart = null ) | Set the important part settings | |
setResizeMode ( string $resizeMode ) | Set the resize mode | |
setTargetHeight ( integer $targetHeight ) | Set the target height | |
setTargetPath ( string $targetPath ) | Set the target path | |
setTargetWidth ( integer $targetWidth ) | Set the target width | |
setZoomLevel ( integer $zoomLevel ) | Set the zoom level |
Method | Description | |
---|---|---|
prepareImage ( ) : Contao\Image\Image | Prepare image object. | |
prepareImportantPart ( ) : Contao\Image\ImportantPart | Prepare important part object. | |
prepareResizeConfig ( ) : Contao\Image\ResizeConfiguration | Prepare resize configuration object. |
public __construct ( contao\File $file ) | ||
$file | contao\File | A file instance of the original image |
public computeResize ( ) : array | ||
return | array | The resize coordinates (width, height, target_x, target_y, target_width, target_height) |
public static get ( string $image, integer $width, integer $height, string $mode = '', string $target = null, boolean $force = false ) : string | null | ||
$image | string | The image path |
$width | integer | The target width |
$height | integer | The target height |
$mode | string | The resize mode |
$target | string | An optional target path |
$force | boolean | Override existing target images |
return | string | null | The path of the resized image or null |
public getCacheName ( ) : string | ||
return | string | The cache name |
public getForceOverride ( ) : boolean | ||
return | boolean | True if the target image will be overridden |
public getImportantPart ( ) : array | ||
return | array | The settings array |
public getOriginalPath ( ) : string | ||
return | string | The path of the original image |
public static getPixelValue ( string $size ) : integer | ||
$size | string | The size string |
return | integer | The pixel value |
public getResizeMode ( ) : string | ||
return | string | The resize mode |
public getResizedPath ( ) : string | ||
return | string | The path of the resized image |
public getTargetHeight ( ) : integer | ||
return | integer | The target height |
public getTargetPath ( ) : string | ||
return | string | The target path |
public getTargetWidth ( ) : integer | ||
return | integer | The target width |
public getZoomLevel ( ) : integer | ||
return | integer | The zoom level |
protected prepareImage ( ) : Contao\Image\Image | ||
return | Contao\Image\Image |
protected prepareImportantPart ( ) : Contao\Image\ImportantPart | ||
return | Contao\Image\ImportantPart |
protected prepareResizeConfig ( ) : Contao\Image\ResizeConfiguration | ||
return | Contao\Image\ResizeConfiguration |
public setForceOverride ( boolean $forceOverride ) | ||
$forceOverride | boolean | True to override the target image |
public setImportantPart ( array $importantPart = null ) | ||
$importantPart | array | The settings array |
public setResizeMode ( string $resizeMode ) | ||
$resizeMode | string | The resize mode |
public setTargetHeight ( integer $targetHeight ) | ||
$targetHeight | integer | The target height |
public setTargetPath ( string $targetPath ) | ||
$targetPath | string | The target path |
public setTargetWidth ( integer $targetWidth ) | ||
$targetWidth | integer | The target width |
public setZoomLevel ( integer $zoomLevel ) | ||
$zoomLevel | integer | The zoom level |
protected File,contao $fileObj | ||
return | contao\File |
protected bool $forceOverride | ||
return | boolean |
protected array $importantPart | ||
return | array |
protected string $resizeMode | ||
return | string |
protected int $zoomLevel | ||
return | integer |