PHP Class Pimcore\Image\Adapter\ImageMagick

Inheritance: extends Pimcore\Image\Adapter
Show file Open project: pimcore/pimcore Class Usage Examples

Protected Properties

Property Type Description
$compositeCommandOptions array Options used by the composite script
$compositeScriptPath string
$convertCommandOptions array Options used by the convert script
$convertFilters array Array with filters used with options
$convertScriptPath string
$forceAlpha null
$imagePath null | string The base image path
$outputPath null | string
$resource null | Imagick

Public Methods

Method Description
addCompositeOption ( $name, null $value = null ) : ImageMagick Add option available in the composite tool
addConvertOption ( $name, null $value = null ) : ImageMagick Add option to the command
addFilter ( $optionName, $filterValue ) Add a filter to the convert command
addOverlay ( string $image, integer $x, integer $y, integer $alpha = 100, string $composite = "COMPOSITE_DEFAULT", string $origin = 'top-left' ) : ImageMagick
addOverlayFit ( $image, string $composite = "COMPOSITE_DEFAULT" ) : ImageMagick
applyMask ( $image ) : ImageMagick Add mask to the image
brightnessSaturation ( integer $brightness = 100, integer $saturation = 100, integer $hue = 100 ) : ImageMagick Brightness, saturation and hue setting of the image.
crop ( $x, $y, $width, $height ) : ImageMagick Cuts out a box of the image starting at the given X,Y coordinates and using the width and height.
cropPercent ( $x, $y, $width, $height ) Cuts out a box of the image starting at the given X,Y coordinates and using percentage values of width and height.
frame ( $width, $height ) : ImageMagick Adds frame which cause that the image gets exactly the entered dimensions by adding borders.
gaussianBlur ( integer $radius, float $sigma = 1 ) Blur the image.
generateCanvas ( $width, $height, $color ) : ImageMagick It generates a basic canvas file with specified size and color
getCompositeCommand ( ) : string Return the composite command as a string
getCompositeOptionsAsString ( ) : string Returns the composite options as a string
getCompositeScriptPath ( ) : string Returns the composite cli script path.
getConvertCommand ( ) : string Return the command without an output file path
getConvertFilters ( $optionName ) : array Returns the filters array
getConvertOptionsAsString ( ) : string Returns options parameter for the convert command
getConvertScriptPath ( ) : string Returns the convert cli script path.
getForceAlpha ( ) : boolean
getOutputPath ( ) : null | string
grayscale ( $method = "Rec601Luma" ) : ImageMagick Converts the image into a linear-grayscale image.
load ( $imagePath, array $options = [] ) : ImageMagick loads the image by the specified path
mergeImage ( ImageMagick $backgroundImage ) : ImageMagick Merges the image specified as the argument into the main picture.
mirror ( $mode ) : ImageMagick Creates vertical or horizontal mirror of the image.
resize ( $width, $height ) Resize the image
rotate ( $angle ) : ImageMagick Rotates the image with the given angle.
roundCorners ( $width, $height ) : ImageMagick Rounds the corners to the given width/height.
save ( $path, null $format = null, null $quality = null ) Save the modified image output in the specified path as the first argument.
saveIfRequired ( string $suffix )
sepia ( ) : ImageMagick Applies the sepia effect into the image.
setBackgroundColor ( $color ) : ImageMagick Set the background color of the image.
setBackgroundImage ( $image, null $mode = null, $relativePath = false ) : ImageMagick Set the image background
setCompositeScriptPath ( $compositeScriptPath ) : ImageMagick Composite script path, as a default the adapter is just using 'composite'.
setConvertScriptPath ( $convertScriptPath ) : ImageMagick Convert script path, as a default the adapter is just using 'convert'.
setForceAlpha ( boolean $forceAlpha ) : ImageMagick
setOutputPath ( $path ) : ImageMagick
sharpen ( integer $radius, float $sigma = 1, float $amount = 1, float $threshold = 0.05 ) : ImageMagick Sharpen the image.
trim ( integer $tolerance ) : ImageMagick Trims edges

Protected Methods

Method Description
createTmpImage ( $imagePath, $suffix ) : ImageMagick Creates the tmp image, that image will be automatically deleted when the process finishes.
destroy ( ) : ImageMagick
initResource ( ) : ImageMagick
processCommand ( $command ) : integer
processOverlay ( ImageMagick $overlayImage, string $composite = "COMPOSITE_DEFAULT", $x, $y, $overlayOpacity = 100 ) : ImageMagick
setTmpPaths ( ImageMagick $image, $suffix )

Method Details

addCompositeOption() public method

Add option available in the composite tool
public addCompositeOption ( $name, null $value = null ) : ImageMagick
$name
$value null
return ImageMagick

addConvertOption() public method

Add option to the command
public addConvertOption ( $name, null $value = null ) : ImageMagick
$name
$value null
return ImageMagick

addFilter() public method

Add a filter to the convert command
public addFilter ( $optionName, $filterValue )
$optionName
$filterValue

addOverlay() public method

public addOverlay ( string $image, integer $x, integer $y, integer $alpha = 100, string $composite = "COMPOSITE_DEFAULT", string $origin = 'top-left' ) : ImageMagick
$image string
$x integer
$y integer
$alpha integer
$composite string
$origin string
return ImageMagick

addOverlayFit() public method

public addOverlayFit ( $image, string $composite = "COMPOSITE_DEFAULT" ) : ImageMagick
$image
$composite string
return ImageMagick

applyMask() public method

Add mask to the image
public applyMask ( $image ) : ImageMagick
$image
return ImageMagick

brightnessSaturation() public method

Brightness, saturation and hue setting of the image.
public brightnessSaturation ( integer $brightness = 100, integer $saturation = 100, integer $hue = 100 ) : ImageMagick
$brightness integer
$saturation integer
$hue integer
return ImageMagick

createTmpImage() protected method

Creates the tmp image, that image will be automatically deleted when the process finishes.
protected createTmpImage ( $imagePath, $suffix ) : ImageMagick
$imagePath
$suffix
return ImageMagick

crop() public method

Cuts out a box of the image starting at the given X,Y coordinates and using the width and height.
public crop ( $x, $y, $width, $height ) : ImageMagick
$x
$y
$width
$height
return ImageMagick

cropPercent() public method

Cuts out a box of the image starting at the given X,Y coordinates and using percentage values of width and height.
public cropPercent ( $x, $y, $width, $height )
$x
$y
$width
$height

destroy() protected method

protected destroy ( ) : ImageMagick
return ImageMagick

frame() public method

Adds frame which cause that the image gets exactly the entered dimensions by adding borders.
public frame ( $width, $height ) : ImageMagick
$width
$height
return ImageMagick

gaussianBlur() public method

Blur the image.
public gaussianBlur ( integer $radius, float $sigma = 1 )
$radius integer
$sigma float

generateCanvas() public method

It generates a basic canvas file with specified size and color
public generateCanvas ( $width, $height, $color ) : ImageMagick
$width
$height
$color
return ImageMagick

getCompositeCommand() public method

Return the composite command as a string
public getCompositeCommand ( ) : string
return string

getCompositeOptionsAsString() public method

Returns the composite options as a string

getCompositeScriptPath() public method

Returns the composite cli script path.
public getCompositeScriptPath ( ) : string
return string

getConvertCommand() public method

Return the command without an output file path
public getConvertCommand ( ) : string
return string

getConvertFilters() public method

Returns the filters array
public getConvertFilters ( $optionName ) : array
$optionName
return array

getConvertOptionsAsString() public method

Returns options parameter for the convert command

getConvertScriptPath() public method

Returns the convert cli script path.
public getConvertScriptPath ( ) : string
return string

getForceAlpha() public method

public getForceAlpha ( ) : boolean
return boolean

getOutputPath() public method

public getOutputPath ( ) : null | string
return null | string

grayscale() public method

Converts the image into a linear-grayscale image.
public grayscale ( $method = "Rec601Luma" ) : ImageMagick
return ImageMagick

initResource() protected method

protected initResource ( ) : ImageMagick
return ImageMagick

load() public method

loads the image by the specified path
public load ( $imagePath, array $options = [] ) : ImageMagick
$imagePath
$options array
return ImageMagick

mergeImage() public method

Merges the image specified as the argument into the main picture.
public mergeImage ( ImageMagick $backgroundImage ) : ImageMagick
$backgroundImage ImageMagick
return ImageMagick

mirror() public method

Creates vertical or horizontal mirror of the image.
public mirror ( $mode ) : ImageMagick
$mode
return ImageMagick

processCommand() protected method

protected processCommand ( $command ) : integer
$command
return integer

processOverlay() protected method

protected processOverlay ( ImageMagick $overlayImage, string $composite = "COMPOSITE_DEFAULT", $x, $y, $overlayOpacity = 100 ) : ImageMagick
$overlayImage ImageMagick
$composite string
return ImageMagick

resize() public method

Resize the image
public resize ( $width, $height )
$width
$height

rotate() public method

Rotates the image with the given angle.
public rotate ( $angle ) : ImageMagick
$angle
return ImageMagick

roundCorners() public method

Rounds the corners to the given width/height.
public roundCorners ( $width, $height ) : ImageMagick
$width
$height
return ImageMagick

save() public method

Save the modified image output in the specified path as the first argument.
public save ( $path, null $format = null, null $quality = null )
$path
$format null
$quality null

saveIfRequired() public method

public saveIfRequired ( string $suffix )
$suffix string a thumbnail identifier

sepia() public method

Applies the sepia effect into the image.
public sepia ( ) : ImageMagick
return ImageMagick

setBackgroundColor() public method

Set the background color of the image.
public setBackgroundColor ( $color ) : ImageMagick
$color
return ImageMagick

setBackgroundImage() public method

Set the image background
public setBackgroundImage ( $image, null $mode = null, $relativePath = false ) : ImageMagick
$image
$mode null
return ImageMagick

setCompositeScriptPath() public method

Composite script path, as a default the adapter is just using 'composite'.
public setCompositeScriptPath ( $compositeScriptPath ) : ImageMagick
return ImageMagick

setConvertScriptPath() public method

Convert script path, as a default the adapter is just using 'convert'.
public setConvertScriptPath ( $convertScriptPath ) : ImageMagick
$convertScriptPath
return ImageMagick

setForceAlpha() public method

public setForceAlpha ( boolean $forceAlpha ) : ImageMagick
$forceAlpha boolean
return ImageMagick

setOutputPath() public method

public setOutputPath ( $path ) : ImageMagick
$path
return ImageMagick

setTmpPaths() protected method

protected setTmpPaths ( ImageMagick $image, $suffix )
$image ImageMagick

sharpen() public method

Sharpen the image.
public sharpen ( integer $radius, float $sigma = 1, float $amount = 1, float $threshold = 0.05 ) : ImageMagick
$radius integer
$sigma float
$amount float
$threshold float
return ImageMagick

trim() public method

Trims edges
public trim ( integer $tolerance ) : ImageMagick
$tolerance integer
return ImageMagick

Property Details

$compositeCommandOptions protected property

Options used by the composite script
protected array $compositeCommandOptions
return array

$compositeScriptPath protected property

protected string $compositeScriptPath
return string

$convertCommandOptions protected property

Options used by the convert script
protected array $convertCommandOptions
return array

$convertFilters protected property

Array with filters used with options
protected array $convertFilters
return array

$convertScriptPath protected property

protected string $convertScriptPath
return string

$forceAlpha protected property

protected null $forceAlpha
return null

$imagePath protected property

The base image path
protected null|string $imagePath
return null | string

$outputPath protected property

protected null|string $outputPath
return null | string

$resource protected property

protected null|Imagick,Pimcore\Image\Adapter $resource
return null | Imagick