class GdDriver extends InterventionDriver

Properties

protected Transformation>, callable> $transformationHandlers

The registered transformation handlers.

from  InterventionDriver
protected ImageManagerInterface $manager

The Intervention image manager instance.

from  InterventionDriver

Methods

__construct()

Create a new Intervention driver instance.

ImageManagerInterface
createManager()

Create the underlying Intervention image manager.

void
ensureRequirementsAreMet()

Ensure Intervention Image is installed.

string
process(string $contents, ImagePipeline $pipeline)

Process the given image contents with the specified pipeline.

array
dimensions(string $contents)

Get the dimensions of the given image contents.

string|null
resolveBackground(ImageInterface $image, string|null $background)

Resolve a background color, expanding the "dominant" sentinel when needed.

string
dominantColor(string $contents)

Get the dominant (average) color of the image as a hex string.

string
dominantColorFrom(ImageInterface $image)

Sample the dominant color by resizing the image to a single pixel.

transformUsing(string $transformation, callable $callback)

Register a transformation handler.

callable|null
transformationHandlerFor(Transformation $transformation)

Get the handler for the given transformation.

Details

in InterventionDriver at line 57
__construct()

Create a new Intervention driver instance.

at line 16
protected ImageManagerInterface createManager()

Create the underlying Intervention image manager.

Return Value

ImageManagerInterface

in InterventionDriver at line 73
void ensureRequirementsAreMet()

Ensure Intervention Image is installed.

Return Value

void

Exceptions

ImageException

in InterventionDriver at line 86
string process(string $contents, ImagePipeline $pipeline)

Process the given image contents with the specified pipeline.

Parameters

string $contents
ImagePipeline $pipeline

Return Value

string

in InterventionDriver at line 159
array dimensions(string $contents)

Get the dimensions of the given image contents.

Parameters

string $contents

Return Value

array

in InterventionDriver at line 173
protected string|null resolveBackground(ImageInterface $image, string|null $background)

Resolve a background color, expanding the "dominant" sentinel when needed.

Parameters

ImageInterface $image
string|null $background

Return Value

string|null

in InterventionDriver at line 183
string dominantColor(string $contents)

Get the dominant (average) color of the image as a hex string.

Parameters

string $contents

Return Value

string

in InterventionDriver at line 197
protected string dominantColorFrom(ImageInterface $image)

Sample the dominant color by resizing the image to a single pixel.

Parameters

ImageInterface $image

Return Value

string

in InterventionDriver at line 216
Driver transformUsing(string $transformation, callable $callback)

Register a transformation handler.

On a cached driver, the handler persists for the worker lifetime and affects every subsequent image processed by it.

Parameters

string $transformation
callable $callback

Return Value

Driver

in InterventionDriver at line 227
protected callable|null transformationHandlerFor(Transformation $transformation)

Get the handler for the given transformation.

Parameters

Transformation $transformation

Return Value

callable|null