\GrafikaGrafika

Contains factory methods for detecting editors, creating editors and images.

Summary

Methods
Properties
Constants
fontsDir()
setEditorList()
detectAvailableEditor()
createEditor()
createImage()
createBlankImage()
createFilter()
createDrawingObject()
No public properties found
DIR
No protected methods found
No protected properties found
N/A
No private methods found
$editorList
N/A

Constants

DIR

DIR = __DIR__

Grafika root directory

Properties

$editorList

$editorList : array

Type

array — List of editors to evaluate.

Methods

fontsDir()

fontsDir() : string

Return path to directory containing fonts used in text operations.

Returns

string

setEditorList()

setEditorList(array  $editorList) 

Change the editor list order of evaluation globally.

Parameters

array $editorList

Throws

\Exception

detectAvailableEditor()

detectAvailableEditor(array  $editorList = null) : string

Detects and return the name of the first supported editor which can either be "Imagick" or "Gd".

Parameters

array $editorList

Array of editor list names. Use this to change the order of evaluation for editors for this function call only. Default order of evaluation is Imagick then GD.

Throws

\Exception

Throws exception if there are no supported editors.

Returns

string —

Name of available editor.

createEditor()

createEditor(array  $editorList = array('Imagick', 'Gd')) : \Grafika\EditorInterface

Creates the first available editor.

Parameters

array $editorList

Array of editor list names. Use this to change the order of evaluation for editors. Default order of evaluation is Imagick then GD.

Throws

\Exception

Returns

\Grafika\EditorInterface

createImage()

createImage(string  $imageFile) : \Grafika\ImageInterface

Create an image.

Parameters

string $imageFile

Path to image file.

Throws

\Exception

Returns

\Grafika\ImageInterface

createBlankImage()

createBlankImage(integer  $width = 1, integer  $height = 1) : \Grafika\ImageInterface

Create a blank image.

Parameters

integer $width

Width of image in pixels.

integer $height

Height of image in pixels.

Throws

\Exception

Returns

\Grafika\ImageInterface

createFilter()

createFilter(string  $filterName) : \Grafika\FilterInterface

Create a filter. Detects available editor to use.

Parameters

string $filterName

The name of the filter.

Throws

\Exception

Returns

\Grafika\FilterInterface

createDrawingObject()

createDrawingObject(string  $drawingObjectName) : \Grafika\DrawingObjectInterface

Draws an object. Detects available editor to use.

Parameters

string $drawingObjectName

The name of the DrawingObject.

Throws

\Exception

We use array_key_exist() instead of isset() to be able to detect a parameter with a NULL value.

Returns

\Grafika\DrawingObjectInterface