Constants

IMAGE_GRAY

IMAGE_GRAY

Colorspace constants

IMAGE_RGB

IMAGE_RGB

IMAGE_CMYK

IMAGE_CMYK

Properties

$resource

$resource : mixed

Image resource

Type

mixed

$name

$name : string

Image name

Type

string

$width

$width : integer

Image width

Type

integer

$height

$height : integer

Image height

Type

integer

$format

$format : string

Image format

Type

string

$colorspace

$colorspace : integer

Image colorspace

Type

integer

$indexed

$indexed : boolean

Index color flag

Type

boolean

$exif

$exif : array

EXIF data

Type

array

$compression

$compression : integer

Image compression

Type

integer

$imageFilter

$imageFilter : integer

Image filter

Type

integer

$imageBlur

$imageBlur : float

Image blur

Type

float

Methods

__construct()

__construct() 

Constructor

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

createResource()

createResource() : void

Create the image resource

getResource()

getResource() : resource

Get the image resource

Returns

resource

hasResource()

hasResource() : boolean

Determine if there is an image resource

Returns

boolean

getName()

getName() : string

Get the image name

Returns

string

getWidth()

getWidth() : integer

Get the image width

Returns

integer

getHeight()

getHeight() : integer

Get the image height

Returns

integer

getColorspace()

getColorspace() : integer

Get the colorspace

Returns

integer

isIndexed()

isIndexed() : boolean

Determine if the image is index color

Returns

boolean

getFormat()

getFormat() : string

Get the image format

Returns

string

getExif()

getExif() : array

Get the image EXIF data

Returns

array

isGray()

isGray() : boolean

Determine if the image is grayscale

Returns

boolean

isRgb()

isRgb() : boolean

Determine if the image is RGB

Returns

boolean

isCmyk()

isCmyk() : boolean

Determine if the image is CMYK

Returns

boolean

sendHeaders()

sendHeaders(string  $to = null, boolean  $download = false) : void

Send image headers the image

Parameters

string $to
boolean $download

__get()

__get(string  $name) : mixed

Magic get method to return a manipulation object

Parameters

string $name

Returns

mixed

load()

load(string  $name = null) : \Pop\Image\Adapter\Imagick

Load the image resource from the existing image file

Parameters

string $name

Throws

\Pop\Image\Adapter\Exception

Returns

\Pop\Image\Adapter\Imagick

loadFromString()

loadFromString(string  $data, string  $name = null) : \Pop\Image\Adapter\Imagick

Load the image resource from data

Parameters

string $data
string $name

Throws

\Pop\Image\Adapter\Exception

Returns

\Pop\Image\Adapter\Imagick

create()

create(integer  $width = null, integer  $height = null, string  $name = null) : \Pop\Image\Adapter\Imagick

Create a new image resource

Parameters

integer $width
integer $height
string $name

Throws

\Pop\Image\Adapter\Exception

Returns

\Pop\Image\Adapter\Imagick

createIndex()

createIndex(integer  $width = null, integer  $height = null, string  $name = null) : \Pop\Image\Adapter\Imagick

Create a new image resource

Parameters

integer $width
integer $height
string $name

Throws

\Pop\Image\Adapter\Exception

Returns

\Pop\Image\Adapter\Imagick

resizeToWidth()

resizeToWidth(integer  $w) : \Pop\Image\Adapter\Imagick

Resize the image object to the width parameter passed

Parameters

integer $w

Returns

\Pop\Image\Adapter\Imagick

resizeToHeight()

resizeToHeight(integer  $h) : \Pop\Image\Adapter\Imagick

Resize the image object to the height parameter passed

Parameters

integer $h

Returns

\Pop\Image\Adapter\Imagick

resize()

resize(integer  $px) : \Pop\Image\Adapter\Imagick

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

Parameters

integer $px

Returns

\Pop\Image\Adapter\Imagick

scale()

scale(float  $scale) : \Pop\Image\Adapter\Imagick

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

Parameters

float $scale

Returns

\Pop\Image\Adapter\Imagick

crop()

crop(integer  $w, integer  $h, integer  $x, integer  $y) : \Pop\Image\Adapter\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.

Parameters

integer $w
integer $h
integer $x
integer $y

Returns

\Pop\Image\Adapter\Imagick

cropThumb()

cropThumb(integer  $px, integer  $offset = null) : \Pop\Image\Adapter\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.

Parameters

integer $px
integer $offset

Returns

\Pop\Image\Adapter\Imagick

convert()

convert(string  $to) : \Pop\Image\Adapter\Imagick

Convert the image object to another format

Parameters

string $to

Returns

\Pop\Image\Adapter\Imagick

writeToFile()

writeToFile(string  $to = null, integer  $quality = 100) : void

Write the image object to a file on disk

Parameters

string $to
integer $quality

Throws

\Pop\Image\Adapter\Exception

outputToHttp()

outputToHttp(integer  $quality = 100, string  $to = null, boolean  $download = false, boolean  $sendHeaders = true) : void

Output the image object directly to HTTP

Parameters

integer $quality
string $to
boolean $download
boolean $sendHeaders

Throws

\Pop\Image\Adapter\Exception

destroy()

destroy(boolean  $delete = false) : void

Destroy the image object and the related image file directly

Parameters

boolean $delete

createColor()

createColor(\Pop\Image\Color\ColorInterface  $color = null, integer  $alpha = 100) : \ImagickPixel

Create and return a color.

Parameters

\Pop\Image\Color\ColorInterface $color
integer $alpha

Throws

\Pop\Image\Adapter\Exception

Returns

\ImagickPixel

__toString()

__toString() : string

Output the image

Returns

string

setResolution()

setResolution(integer  $x, integer  $y = null) : \Pop\Image\Adapter\Imagick

Set the image resolution

Parameters

integer $x
integer $y

Returns

\Pop\Image\Adapter\Imagick

setImageColorspace()

setImageColorspace(integer  $colorspace) : \Pop\Image\Adapter\Imagick

Set the image colorspace

Parameters

integer $colorspace

Returns

\Pop\Image\Adapter\Imagick

setCompression()

setCompression(integer  $compression) : \Pop\Image\Adapter\Imagick

Set the image compression

Parameters

integer $compression

Returns

\Pop\Image\Adapter\Imagick

setImageFilter()

setImageFilter(integer  $filter) : \Pop\Image\Adapter\Imagick

Set the image filter

Parameters

integer $filter

Returns

\Pop\Image\Adapter\Imagick

setImageBlur()

setImageBlur(float  $blur) : \Pop\Image\Adapter\Imagick

Set the image blur

Parameters

float $blur

Returns

\Pop\Image\Adapter\Imagick

getCompression()

getCompression() : integer

Get the image compression

Returns

integer

getImageFilter()

getImageFilter() : integer

Get the image filter

Returns

integer

getImageBlur()

getImageBlur() : float

Get the image blur

Returns

float