Properties

$resource

$resource : mixed

Image resource

Type

mixed

$fullpath

$fullpath : string

Full path of image file, i.e. '/path/to/image.ext'

Type

string

$dir

$dir : string

Full, absolute directory of the image file, i.e. '/some/dir/'

Type

string

$basename

$basename : string

Full basename of image file, i.e. 'image.ext'

Type

string

$filename

$filename : string

Full filename of image file, i.e. 'image'

Type

string

$extension

$extension : string

Image file extension, i.e. 'ext'

Type

string

$size

$size : integer

Image file size in bytes

Type

integer

$mime

$mime : string

Image file mime type

Type

string

$output

$output : mixed

Image file output buffer

Type

mixed

$width

$width : integer

Image width

Type

integer

$height

$height : integer

Image height

Type

integer

$allowed

$allowed : array

Array of allowed image types.

Type

array

$fillColor

$fillColor : mixed

SVG image fill color

Type

mixed

$backgroundColor

$backgroundColor : mixed

SVG image background color

Type

mixed

$strokeColor

$strokeColor : mixed

SVG image stroke color

Type

mixed

$strokeWidth

$strokeWidth : array

SVG image stroke width

Type

array

$strokeDashLength

$strokeDashLength : integer

Stroke dash length

Type

integer

$strokeDashGap

$strokeDashGap : integer

Stroke dash gap

Type

integer

$gradients

$gradients : array

SVG image available gradients

Type

array

$curGradient

$curGradient : integer

Current gradient to use.

Type

integer

$opacity

$opacity : float

SVG image color opacity

Type

float

$units

$units : string

SVG image units

Type

string

$allowedUnits

$allowedUnits : array

Array of allowed units.

Type

array

Methods

__construct()

__construct(string  $img = null, integer  $w = null, integer  $h = null) : \Pop\Image\Svg

Constructor

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

Parameters

string $img
integer $w
integer $h

Throws

\Pop\Image\Exception

Returns

\Pop\Image\Svg

resource()

resource() : resource

Get the image resource

Returns

resource

getFullpath()

getFullpath() : string

Get the image full path

Returns

string

getDir()

getDir() : string

Get the image directory

Returns

string

getBasename()

getBasename() : string

Get the image basename

Returns

string

getFilename()

getFilename() : string

Get the image filename

Returns

string

getExtension()

getExtension() : string

Get the image extension

Returns

string

getSize()

getSize() : integer

Get the image size

Returns

integer

getMime()

getMime() : string

Get the image mime type

Returns

string

getWidth()

getWidth() : integer

Get the image width.

Returns

integer

getHeight()

getHeight() : integer

Get the image height.

Returns

integer

__get()

__get(string  $name) : mixed

Magic get method to return a manipulation object

Parameters

string $name

Returns

mixed

create()

create(integer  $width, integer  $height, string  $image = null) : \Pop\Image\Svg

Create a new SVG image resource

Parameters

integer $width
integer $height
string $image

Returns

\Pop\Image\Svg

load()

load(string  $image) : \Pop\Image\Svg

Load an existing SVG image resource

Parameters

string $image

Returns

\Pop\Image\Svg

save()

save(string  $to = null) : void

Save the image object to disk.

Parameters

string $to

output()

output(boolean  $download = false, boolean  $sendHeaders = true) : void

Output the image object directly.

Parameters

boolean $download
boolean $sendHeaders

Throws

\Pop\Image\Exception

destroy()

destroy(boolean  $delete = false) : void

Destroy the image object and the related image file directly.

Parameters

boolean $delete

getUnits()

getUnits() : string

Get the SVG image units.

Returns

string

addRadialGradient()

addRadialGradient(array  $color1, array  $color2, float  $opacity = 1.0) : \Pop\Image\Svg

Add a gradient

Parameters

array $color1
array $color2
float $opacity

Throws

\InvalidArgumentException

Returns

\Pop\Image\Svg

addLinearGradient()

addLinearGradient(array  $color1, array  $color2, float  $opacity = 1.0, boolean  $vertical = true) : \Pop\Image\Svg

Add a gradient

Parameters

array $color1
array $color2
float $opacity
boolean $vertical

Throws

\InvalidArgumentException

Returns

\Pop\Image\Svg

getGradients()

getGradients() : array

Get the gradients

Returns

array

getNumberOfGradients()

getNumberOfGradients() : integer

Get the number of gradients

Returns

integer

getCurGradient()

getCurGradient() : mixed

Get the current gradient index

Returns

mixed

setCurGradient()

setCurGradient(mixed  $grad) : \Pop\Image\Svg

Get the current gradient index

Parameters

mixed $grad

Returns

\Pop\Image\Svg

__toString()

__toString() : string

To string method to output the image

Returns

string

setImage()

setImage(string  $img) : void

Set the image properties

Parameters

string $img

Throws

\Pop\Image\Exception

parseDimensions()

parseDimensions(mixed  $w, mixed  $h) : void

Parse and set the image dimensions and units

Parameters

mixed $w
mixed $h

colorIsValid()

colorIsValid(array  $color) : boolean

Check if a valid color array was passed

Parameters

array $color

Returns

boolean