Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Glide Laravel Package

league/glide

Glide is an on-demand PHP image manipulation library served over HTTP. Resize, crop, and apply effects with simple URL parameters, with automatic caching and far-future headers. Works with GD, Imagick, or libvips and Flysystem storage.

View on GitHub
Deep Wiki
Context7

layout: default title: Setup

Setup

All the Glide configuration is managed through a central object called the Server. This includes the image source location (where the original images are saved), the image cache location (where the manipulated images are saved), as well as all other configuration options.

Setup with factory

The easiest way to configure the Server is using the supplied factory.

<?php

$server = League\Glide\ServerFactory::create([
    'source' =>                  // Source filesystem
    'source_path_prefix' =>      // Source filesystem path prefix
    'cache' =>                   // Cache filesystem
    'cache_path_prefix' =>       // Cache filesystem path prefix
    'temp_dir' =>                // Temporary directory where cache EXIF data should be stored
                                 // (defaults to sys_get_temp_dir())
    'group_cache_in_folders' =>  // Whether to group cached images in folders
    'watermarks' =>              // Watermarks filesystem
    'watermarks_path_prefix' =>  // Watermarks filesystem path prefix
    'driver' =>                  // Image driver (gd or imagick)
    'max_image_size' =>          // Image size limit
    'defaults' =>                // Default image manipulations
    'presets' =>                 // Preset image manipulations
    'base_url' =>                // Base URL of the images
    'response' =>                // Response factory
]);

Setup manually

You can also choose to instantiate the Server object manually. This allows finer control over what dependencies are being used. For example, if you wanted to add additional functionality to the API, you could load custom manipulators in addition to those provided with Glide.

<?php

// Set source filesystem
$source = new League\Flysystem\Filesystem(
    new League\Flysystem\Adapter\Local('path/to/source/folder')
);

// Set cache filesystem
$cache = new League\Flysystem\Filesystem(
    new League\Flysystem\Adapter\Local('path/to/cache/folder')
);

// Set watermarks filesystem
$watermarks = new League\Flysystem\Filesystem(
    new League\Flysystem\Adapter\Local('path/to/watermarks/folder')
);

// Set image manager
$imageManager = new Intervention\Image\ImageManager([
    'driver' => 'gd',
]);

// Set manipulators
$manipulators = [
    new League\Glide\Manipulators\Orientation(),
    new League\Glide\Manipulators\Crop(),
    new League\Glide\Manipulators\Size(2000*2000),
    new League\Glide\Manipulators\Brightness(),
    new League\Glide\Manipulators\Contrast(),
    new League\Glide\Manipulators\Gamma(),
    new League\Glide\Manipulators\Sharpen(),
    new League\Glide\Manipulators\Filter(),
    new League\Glide\Manipulators\Blur(),
    new League\Glide\Manipulators\Pixelate(),
    new League\Glide\Manipulators\Watermark($watermarks),
    new League\Glide\Manipulators\Background(),
    new League\Glide\Manipulators\Border(),
    new League\Glide\Manipulators\Encode(),
];

// Set API
$api = new League\Glide\Api\Api($imageManager, $manipulators);

// Setup Glide server
$server = new League\Glide\Server(
    $source,
    $cache,
    $api,
);

// Set response factory
$server->setResponseFactory(new SymfonyResponseFactory());
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai