Documentation

Imagick extends AbstractAdapter
in package

Imagick adapter class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2021 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
3.4.0

Table of Contents

IMAGE_CMYK  = 3
IMAGE_GRAY  = 1
Colorspace constants
IMAGE_RGB  = 2
$adjust  : AdjustInterface
Image adjust object
$colorspace  : int
Image colorspace
$compression  : int
Image compression
$draw  : DrawInterface
Image draw object
$effect  : EffectInterface
Image effect object
$exif  : array<string|int, mixed>
EXIF data
$filter  : FilterInterface
Image filter object
$format  : string
Image format
$height  : int
Image height
$imageBlur  : float
Image blur
$imageFilter  : int
Image filter
$indexed  : bool
Index color flag
$layer  : LayerInterface
Image layer object
$name  : string
Image name
$resource  : mixed
Image resource
$type  : TypeInterface
Image type object
$width  : int
Image width
__construct()  : mixed
Constructor
__get()  : mixed
Magic get method to return a manipulation object
__toString()  : string
Output the image
addImage()  : Imagick
Add image to the image resource
adjust()  : AdjustInterface
Get the image adjust object
convert()  : Imagick
Convert the image object to another format
create()  : Imagick
Create a new image resource
createColor()  : ImagickPixel
Create and return a color.
createIndex()  : Imagick
Create a new image resource
createResource()  : void
Create the image resource
crop()  : Imagick
Crop the image object to a image whose dimensions are based on the value of the $wid and $hgt argument. The optional $x and $y arguments allow for the adjustment of the crop to select a certain area of the image to be cropped.
cropImage()  : Imagick
Crop image, checking for multiple frames
cropThumb()  : Imagick
Crop the image object to a square image whose dimensions are based on the value of the $px argument. The optional $offset argument allows for the adjustment of the crop to select a certain area of the image to be cropped.
cropThumbnailImage()  : Imagick
Crop image, checking for multiple frames
destroy()  : void
Destroy the image object and the related image file directly
draw()  : DrawInterface
Get the image draw object
effect()  : EffectInterface
Get the image effect object
filter()  : FilterInterface
Get the image filter object
flip()  : Imagick
Method to flip the image over the x-axis
flop()  : Imagick
Method to flip the image over the y-axis
getColorspace()  : int
Get the colorspace
getCompression()  : int
Get the image compression
getExif()  : array<string|int, mixed>
Get the image EXIF data
getFormat()  : string
Get the image format
getHeight()  : int
Get the image height
getImageBlur()  : float
Get the image blur
getImageFilter()  : int
Get the image filter
getImages()  : array<string|int, mixed>
Get images
getName()  : string
Get the image name
getNumberOfImages()  : int
Get number of images
getResource()  : resource
Get the image resource
getWidth()  : int
Get the image width
hasImages()  : bool
Does image have images
hasResource()  : bool
Determine if there is an image resource
isCmyk()  : bool
Determine if the image is CMYK
isGray()  : bool
Determine if the image is grayscale
isIndexed()  : bool
Determine if the image is index color
isRgb()  : bool
Determine if the image is RGB
layer()  : LayerInterface
Get the image layer object
load()  : Imagick
Load the image resource from the existing image file
loadFromString()  : Imagick
Load the image resource from data
outputToHttp()  : void
Output the image object directly to HTTP
rebuildImages()  : Imagick
Get images
resize()  : Imagick
Resize the image object, allowing for the largest dimension to be scaled to the value of the $px argument.
resizeImage()  : Imagick
Resize image, checking for multiple frames
resizeToHeight()  : Imagick
Resize the image object to the height parameter passed
resizeToWidth()  : Imagick
Resize the image object to the width parameter passed
rotate()  : Imagick
Rotate the image object
scale()  : Imagick
Scale the image object, allowing for the dimensions to be scaled proportionally to the value of the $scl argument.
sendHeaders()  : void
Send image headers the image
setAdjust()  : AbstractAdapter
Set the image adjust object
setCompression()  : Imagick
Set the image compression
setDraw()  : AbstractAdapter
Set the image draw object
setEffect()  : AbstractAdapter
Set the image effect object
setFilter()  : AbstractAdapter
Set the image filter object
setImageBlur()  : Imagick
Set the image blur
setImageColorspace()  : Imagick
Set the image colorspace
setImageFilter()  : Imagick
Set the image filter
setLayer()  : AbstractAdapter
Set the image layer object
setResolution()  : Imagick
Set the image resolution
setType()  : AbstractAdapter
Set the image type object
type()  : TypeInterface
Get the image type object
writeToFile()  : void
Write the image object to a file on disk

Constants

Properties

$compression

Image compression

protected int $compression = null

$imageBlur

Image blur

protected float $imageBlur = 1

$imageFilter

Image filter

protected int $imageFilter = Imagick::FILTER_LANCZOS

Methods

__construct()

Constructor

public __construct() : mixed

Instantiate an image object based on either a pre-existing image file on disk, or a new image file.

Return values
mixed

__get()

Magic get method to return a manipulation object

public __get(string $name) : mixed
Parameters
$name : string
Return values
mixed

__toString()

Output the image

public __toString() : string
Return values
string

addImage()

Add image to the image resource

public addImage(mixed $image[, int $delay = null ]) : Imagick
Parameters
$image : mixed
$delay : int = null
Return values
Imagick

convert()

Convert the image object to another format

public convert(string $to) : Imagick
Parameters
$to : string
Return values
Imagick

create()

Create a new image resource

public create([int $width = null ][, int $height = null ][, string $name = null ]) : Imagick
Parameters
$width : int = null
$height : int = null
$name : string = null
Return values
Imagick

createColor()

Create and return a color.

public createColor([ColorInterface $color = null ][, int $alpha = 100 ]) : ImagickPixel
Parameters
$color : ColorInterface = null
$alpha : int = 100
Return values
ImagickPixel

createIndex()

Create a new image resource

public createIndex([int $width = null ][, int $height = null ][, string $name = null ]) : Imagick
Parameters
$width : int = null
$height : int = null
$name : string = null
Return values
Imagick

createResource()

Create the image resource

public createResource() : void
Return values
void

crop()

Crop the image object to a image whose dimensions are based on the value of the $wid and $hgt argument. The optional $x and $y arguments allow for the adjustment of the crop to select a certain area of the image to be cropped.

public crop(int $w, int $h, int $x, int $y) : Imagick
Parameters
$w : int
$h : int
$x : int
$y : int
Return values
Imagick

cropImage()

Crop image, checking for multiple frames

public cropImage(int $width, int $height, int $x, int $y) : Imagick
Parameters
$width : int
$height : int
$x : int
$y : int
Return values
Imagick

cropThumb()

Crop the image object to a square image whose dimensions are based on the value of the $px argument. The optional $offset argument allows for the adjustment of the crop to select a certain area of the image to be cropped.

public cropThumb(int $px[, int $offset = null ]) : Imagick
Parameters
$px : int
$offset : int = null
Return values
Imagick

cropThumbnailImage()

Crop image, checking for multiple frames

public cropThumbnailImage(int $width, int $height) : Imagick
Parameters
$width : int
$height : int
Return values
Imagick

destroy()

Destroy the image object and the related image file directly

public destroy([bool $delete = false ]) : void
Parameters
$delete : bool = false
Return values
void

getColorspace()

Get the colorspace

public getColorspace() : int
Return values
int

getCompression()

Get the image compression

public getCompression() : int
Return values
int

getExif()

Get the image EXIF data

public getExif() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFormat()

Get the image format

public getFormat() : string
Return values
string

getHeight()

Get the image height

public getHeight() : int
Return values
int

getImageBlur()

Get the image blur

public getImageBlur() : float
Return values
float

getImageFilter()

Get the image filter

public getImageFilter() : int
Return values
int

getImages()

Get images

public getImages() : array<string|int, mixed>
Return values
array<string|int, mixed>

getName()

Get the image name

public getName() : string
Return values
string

getNumberOfImages()

Get number of images

public getNumberOfImages() : int
Return values
int

getResource()

Get the image resource

public getResource() : resource
Return values
resource

getWidth()

Get the image width

public getWidth() : int
Return values
int

hasImages()

Does image have images

public hasImages() : bool
Return values
bool

hasResource()

Determine if there is an image resource

public hasResource() : bool
Return values
bool

isCmyk()

Determine if the image is CMYK

public isCmyk() : bool
Return values
bool

isGray()

Determine if the image is grayscale

public isGray() : bool
Return values
bool

isIndexed()

Determine if the image is index color

public isIndexed() : bool
Return values
bool

isRgb()

Determine if the image is RGB

public isRgb() : bool
Return values
bool

load()

Load the image resource from the existing image file

public load([string $name = null ]) : Imagick
Parameters
$name : string = null
Tags
throws
Exception
Return values
Imagick

loadFromString()

Load the image resource from data

public loadFromString(string $data[, string $name = null ]) : Imagick
Parameters
$data : string
$name : string = null
Return values
Imagick

outputToHttp()

Output the image object directly to HTTP

public outputToHttp([int $quality = 100 ][, string $to = null ][, bool $download = false ][, bool $sendHeaders = true ][, array<string|int, mixed> $headers = [] ]) : void
Parameters
$quality : int = 100
$to : string = null
$download : bool = false
$sendHeaders : bool = true
$headers : array<string|int, mixed> = []
Tags
throws
Exception
Return values
void

rebuildImages()

Get images

public rebuildImages(Imagick $images) : Imagick
Parameters
$images : Imagick
Return values
Imagick

resize()

Resize the image object, allowing for the largest dimension to be scaled to the value of the $px argument.

public resize(int $px) : Imagick
Parameters
$px : int
Return values
Imagick

resizeImage()

Resize image, checking for multiple frames

public resizeImage(int $width, int $height[, int $filter = null ][, int $blur = null ]) : Imagick
Parameters
$width : int
$height : int
$filter : int = null
$blur : int = null
Return values
Imagick

resizeToHeight()

Resize the image object to the height parameter passed

public resizeToHeight(int $h) : Imagick
Parameters
$h : int
Return values
Imagick

resizeToWidth()

Resize the image object to the width parameter passed

public resizeToWidth(int $w) : Imagick
Parameters
$w : int
Return values
Imagick

scale()

Scale the image object, allowing for the dimensions to be scaled proportionally to the value of the $scl argument.

public scale(float $scale) : Imagick
Parameters
$scale : float
Return values
Imagick

sendHeaders()

Send image headers the image

public sendHeaders([string $to = null ][, bool $download = false ][, array<string|int, mixed> $additionalHeaders = [] ]) : void
Parameters
$to : string = null
$download : bool = false
$additionalHeaders : array<string|int, mixed> = []
Return values
void

setCompression()

Set the image compression

public setCompression(int $compression) : Imagick
Parameters
$compression : int
Return values
Imagick

setImageBlur()

Set the image blur

public setImageBlur(float $blur) : Imagick
Parameters
$blur : float
Return values
Imagick

setImageColorspace()

Set the image colorspace

public setImageColorspace(int $colorspace) : Imagick
Parameters
$colorspace : int
Return values
Imagick

setImageFilter()

Set the image filter

public setImageFilter(int $filter) : Imagick
Parameters
$filter : int
Return values
Imagick

setResolution()

Set the image resolution

public setResolution(int $x[, int $y = null ]) : Imagick
Parameters
$x : int
$y : int = null
Return values
Imagick

writeToFile()

Write the image object to a file on disk

public writeToFile([string $to = null ][, int $quality = 100 ]) : void
Parameters
$to : string = null
$quality : int = 100
Tags
throws
Exception
Return values
void

Search results