Get support for mnapoli/glide-module

If you're new to LTH, please see our FAQ for more information on what it is we do.

Support Options

Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:

View Open Issues

Take a look to see if anyone else has experienced the same issue as you and if they managed to solve it.

Open an Issue

Make sure to read any relevant guidelines for opening issues on this repo before posting a new issue.

Sponsor directly

Check out the page and see if there are any options to sponsor this project or it's developers directly.

mnapoli/glide-module

Glide universal module

This package integrates Glide in any container-interop compatible framework/container.

Installation

composer require mnapoli/glide-module

Once installed, you need to register the GlideModule\GlideServiceProvider into your container.

Refer to your framework or container's documentation to learn how to register service providers.

Usage

This module registers the Glide server under the League\Glide\Server key in your service container. You can now inject it in your services. Have a look at the official documentation to know how to use the server.

Since Glide's server requires the source and cache options to be configured, you must define a glide.options entry in your container. That entry should be an array containing Glide options.

Here is an example using PHP-DI's syntax:

return [
    'glide.options' => [
        'source' => 'path/to/source/folder',
        'cache' => 'path/to/cache/folder',
    ]
];

Here is the same example using Pimple:

$pimple['glide.options'] = [
    'source' => 'path/to/source/folder',
    'cache' => 'path/to/cache/folder',
];

Returning a response

This module automatically configures Glide to generate PSR-7 responses. To use it in a controller, simply inject the League\Glide\Server object and use it like this:

// This returns a PSR-7 response
return $server->getImageResponse($filename, $options);

Advanced options

The glide.options array is passed straight to Glide's ServerFactory. Have a look at the official documentation about configuration to learn about all the options you can use.

Our Mission

We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.

Interesting Articles

Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated

p-e622a1a2