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

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\Gd

Load the image resource from the existing image file

Parameters

string $name

Throws

\Pop\Image\Adapter\Exception

Returns

\Pop\Image\Adapter\Gd

loadFromString()

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

Load the image resource from data

Parameters

string $data
string $name

Throws

\Pop\Image\Adapter\Exception

Returns

\Pop\Image\Adapter\Gd

create()

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

Create a new image resource

Parameters

integer $width
integer $height
string $name

Throws

\Pop\Image\Adapter\Exception

Returns

\Pop\Image\Adapter\Gd

createIndex()

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

Create a new image resource

Parameters

integer $width
integer $height
string $name

Throws

\Pop\Image\Adapter\Exception

Returns

\Pop\Image\Adapter\Gd

resizeToWidth()

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

Resize the image object to the width parameter passed

Parameters

integer $w

Returns

\Pop\Image\Adapter\Gd

resizeToHeight()

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

Resize the image object to the height parameter passed

Parameters

integer $h

Returns

\Pop\Image\Adapter\Gd

resize()

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

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\Gd

scale()

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

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

Parameters

float $scale

Returns

\Pop\Image\Adapter\Gd

crop()

crop(integer  $w, integer  $h, integer  $x, integer  $y) : \Pop\Image\Adapter\Gd

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\Gd

cropThumb()

cropThumb(integer  $px, integer  $offset = null) : \Pop\Image\Adapter\Gd

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\Gd

rotate()

rotate(integer  $degrees, \Pop\Image\Color\ColorInterface  $bgColor = null, integer  $alpha = null) : \Pop\Image\Adapter\Gd

Rotate the image object

Parameters

integer $degrees
\Pop\Image\Color\ColorInterface $bgColor
integer $alpha

Returns

\Pop\Image\Adapter\Gd

flip()

flip() : \Pop\Image\Adapter\Gd

Method to flip the image over the x-axis

Returns

\Pop\Image\Adapter\Gd

flop()

flop() : \Pop\Image\Adapter\Gd

Method to flip the image over the y-axis

Returns

\Pop\Image\Adapter\Gd

convert()

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

Convert the image object to another format

Parameters

string $to

Throws

\Pop\Image\Adapter\Exception

Returns

\Pop\Image\Adapter\Gd

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 = null) : mixed

Create and return a color

Parameters

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

Throws

\Pop\Image\Adapter\Exception

Returns

mixed

__toString()

__toString() : string

Output the image

Returns

string

copyImage()

copyImage(integer  $w, integer  $h, integer  $x, integer  $y) : void

Copy the image resource to the image output resource with the set parameters

Parameters

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

parseImage()

parseImage(array  $size, string  $data) : void

Parse the image data

Parameters

array $size
string $data

generateImage()

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

Parse the image data

Parameters

integer $quality
string $to