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 with an HTTP API. Resize, crop, and apply effects, then cache results with far-future headers. Works with GD, Imagick, or libvips, integrates with Flysystem, and can sign URLs for security.

View on GitHub
Deep Wiki
Context7

layout: default title: Defaults & presets

Defaults & presets

In certain situations you may want to define default image manipulations. For example, maybe you want to specify that all images are outputted as JPEGs (fm=jpg). Or maybe you have a watermark that you want added to all images. Glide makes this possible using default manipulations.

<?php

// Set using factory
$server = League\Glide\ServerFactory::create([
    'defaults' => [
        'mark' => 'logo.png',
        'markw' => '30w',
        'markpad' => '5w',
    ]
]);

// Set using setter method
$server->setDefaults([
    'mark' => 'logo.png',
    'markw' => '30w',
    'markpad' => '5w',
]);

Presets

Glide also makes it possible to define groups of defaults, known as presets. This is helpful if you have standard image manipulations that you use throughout your app.

Configuring presets

<?php

// Set using factory
$server = League\Glide\ServerFactory::create([
    'presets' => [
        'small' => [
            'w' => 200,
            'h' => 200,
            'fit' => 'crop',
        ],
        'medium' => [
            'w' => 600,
            'h' => 400,
            'fit' => 'crop',
        ]
    ]
]);

// Set using setter method
$server->setPresets([
    'small' => [
        'w' => 200,
        'h' => 200,
        'fit' => 'crop',
    ],
    'medium' => [
        'w' => 600,
        'h' => 400,
        'fit' => 'crop',
    ]
]);

Using presets

To use a presets, set it using the p parameter:

<img src="kayaks.jpg?p=small">

It's also possible to use multiple presets together:

<img src="kayaks.jpg?p=small,watermarked">

It's even possible to use presets with additional parameters:

<img src="kayaks.jpg?p=small,watermarked&filt=sepia">

Overriding defaults and presets

You can override the default and preset manipulations for a specific request by passing a new parameter (e.x. mark=different.png), or even disable it entirely by setting it to blank (e.x. mark=).

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.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata