class ImageManager extends Manager (View source)

Traits

Properties

protected Container $container

The container instance.

from  Manager
protected Repository $config

The configuration repository instance.

from  Manager
protected Closure> $customCreators

The registered custom driver creators.

from  Manager
protected array<string, mixed> $drivers

The array of created "drivers".

from  Manager
protected Transformation>, callable>> $transformationHandlers

The registered transformation handlers.

Methods

Closure|null
bindCallbackToSelf(Closure $callback)

Binds the provided callback to the class instance.

__construct(Container $container)

Create a new manager instance.

from  Manager
string|null
getDefaultDriver()

Get the default image driver name.

mixed
driver(UnitEnum|string|null $driver = null)

Get a driver instance.

from  Manager
mixed
createDriver(string $driver)

Create a new driver instance.

mixed
callCustomCreator(string $driver)

Call a custom driver creator.

from  Manager
$this
extend(string $driver, Closure $callback)

Register a custom driver creator Closure.

from  Manager
array<string, mixed>
getDrivers()

Get all of the created "drivers".

from  Manager
getContainer()

Get the container instance used by the manager.

from  Manager
$this
setContainer(Container $container)

Set the container instance used by the manager.

from  Manager
$this
forgetDrivers()

Forget all of the resolved driver instances.

from  Manager
mixed
__call(string $method, array<string, mixed> $parameters)

Dynamically call the default driver instance.

from  Manager
fromBytes(string $contents)

Create an image instance from raw bytes.

fromBase64(string $base64)

Create an image instance from a base64 encoded string.

fromPath(string $path)

Create an image instance from a file path.

fromStorage(string $path, string|null $disk = null)

Create an image instance from a storage disk path.

fromUpload(UploadedFile $file)

Create an image instance from an uploaded file.

fromUrl(string $url)

Create an image instance from a URL.

createGdDriver()

Create the GD image driver.

createImagickDriver()

Create the Imagick image driver.

transformUsing(string $driver, string $transformation, callable $callback)

Register a transformation handler for the given driver.

void
applyTransformationHandlers(string $driver, Driver $instance)

Apply registered transformation handlers to the given driver instance.

Details

protected Closure|null bindCallbackToSelf(Closure $callback)

Binds the provided callback to the class instance.

Parameters

Closure $callback

Return Value

Closure|null

Exceptions

ReflectionException

__construct(Container $container)

Create a new manager instance.

Parameters

Container $container

string|null getDefaultDriver()

Get the default image driver name.

Return Value

string|null

mixed driver(UnitEnum|string|null $driver = null)

Get a driver instance.

Parameters

UnitEnum|string|null $driver

Return Value

mixed

Exceptions

InvalidArgumentException

protected mixed createDriver(string $driver)

Create a new driver instance.

Parameters

string $driver

Return Value

mixed

Exceptions

InvalidArgumentException

protected mixed callCustomCreator(string $driver)

Call a custom driver creator.

Parameters

string $driver

Return Value

mixed

$this extend(string $driver, Closure $callback)

Register a custom driver creator Closure.

Parameters

string $driver
Closure $callback

Return Value

$this

array<string, mixed> getDrivers()

Get all of the created "drivers".

Return Value

array<string, mixed>

Container getContainer()

Get the container instance used by the manager.

Return Value

Container

$this setContainer(Container $container)

Set the container instance used by the manager.

Parameters

Container $container

Return Value

$this

$this forgetDrivers()

Forget all of the resolved driver instances.

Return Value

$this

mixed __call(string $method, array<string, mixed> $parameters)

Dynamically call the default driver instance.

Parameters

string $method
array<string, mixed> $parameters

Return Value

mixed

Image fromBytes(string $contents)

Create an image instance from raw bytes.

Parameters

string $contents

Return Value

Image

Image fromBase64(string $base64)

Create an image instance from a base64 encoded string.

Parameters

string $base64

Return Value

Image

Image fromPath(string $path)

Create an image instance from a file path.

Parameters

string $path

Return Value

Image

Image fromStorage(string $path, string|null $disk = null)

Create an image instance from a storage disk path.

Parameters

string $path
string|null $disk

Return Value

Image

Image fromUpload(UploadedFile $file)

Create an image instance from an uploaded file.

Parameters

UploadedFile $file

Return Value

Image

Image fromUrl(string $url)

Create an image instance from a URL.

Parameters

string $url

Return Value

Image

protected GdDriver createGdDriver()

Create the GD image driver.

Return Value

GdDriver

protected ImagickDriver createImagickDriver()

Create the Imagick image driver.

Return Value

ImagickDriver

ImageManager transformUsing(string $driver, string $transformation, callable $callback)

Register a transformation handler for the given driver.

Parameters

string $driver
string $transformation
callable $callback

Return Value

ImageManager

protected void applyTransformationHandlers(string $driver, Driver $instance)

Apply registered transformation handlers to the given driver instance.

Parameters

string $driver
Driver $instance

Return Value

void

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.