From da45fbe0a962f032e900c1dd2e8e3ff6827384a0 Mon Sep 17 00:00:00 2001 From: Balazs Nasz <788569+balazsnasz@users.noreply.github.com> Date: Tue, 26 May 2026 02:33:33 +0200 Subject: [PATCH 1/2] feat: Set default grow in config --- README.md | 10 +++++++++- config/glide.php | 2 ++ src/GlideImageGenerator.php | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6c3b0d3..491b269 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,15 @@ This will **empty the entire Glide cache**. You can choose to put this in your d ## Glide Configuration -Currently, the package **does not provide configuration** options and it just assumes **sensible defaults**. +Currently, the package **does not provide advanced configuration** options and it just assumes **sensible defaults**. + +If you want to modify the basic configuration values, you can publish the config file: + +```bash +php artisan vendor:publish --tag=glide-config +``` + +After publishing, you can modify the configuration in `config/glide.php`. Since it is geared at auto-generating versions for static images, it will **assume** the `public_path()`/`asset()` as root folder for the images. diff --git a/config/glide.php b/config/glide.php index d593ed6..7bcb4db 100644 --- a/config/glide.php +++ b/config/glide.php @@ -23,4 +23,6 @@ */ 'signed' => false, ], + + 'grow' => false, ]; diff --git a/src/GlideImageGenerator.php b/src/GlideImageGenerator.php index 0bac5ae..43e05dd 100644 --- a/src/GlideImageGenerator.php +++ b/src/GlideImageGenerator.php @@ -15,10 +15,12 @@ class GlideImageGenerator { - public function src(string $path, ?int $maxWidth = null, ?string $sizes = null, bool $lazy = true, bool $grow = false, ?string $disk = null): ComponentAttributeBag + public function src(string $path, ?int $maxWidth = null, ?string $sizes = null, bool $lazy = true, ?bool $grow = null, ?string $disk = null): ComponentAttributeBag { $attributes = new ComponentAttributeBag(); + $grow = $grow ?? config('glide.grow'); + $isGlideSupported = $this->isGlideSupported($path); $attributes->setAttributes([ From 2d042dff4f6eea1ce02a7575bb5efcfa511f702a Mon Sep 17 00:00:00 2001 From: "Ralph J. Smit" Date: Thu, 28 May 2026 23:06:32 +0200 Subject: [PATCH 2/2] Update glide.php --- config/glide.php | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/config/glide.php b/config/glide.php index 53af7e9..1b22e45 100644 --- a/config/glide.php +++ b/config/glide.php @@ -9,6 +9,29 @@ */ 'default_source_disk' => null, + 'route' => [ + /** + * The domain that will be used to generate the Glide URLs. + */ + 'domain' => null, + + /** + * Whether the generated Glide URLs should be signed. + * For some browsers this differing query string + * might prevent browser caching of the image, + * but major browsers appear to handle fine. + */ + 'signed' => false, + ], + + /** + * By default, images receive a `max-width: {originalImageWidth}` rule, + * so that CSS will not upscale them beyond their original width. This + * can be overridden on a per-image basis using the `grow` function + * parameter. However, it can also be configured globally here. + */ + 'grow' => false, + /** * The default image scales to generate. */ @@ -30,23 +53,6 @@ 10000, ], - 'route' => [ - /** - * The domain that will be used to generate the Glide URLs. - */ - 'domain' => null, - - /** - * Whether the generated Glide URLs should be signed. - * For some browsers this differing query string - * might prevent browser caching of the image, - * but major browsers appear to handle fine. - */ - 'signed' => false, - ], - - 'grow' => false, - /** * By default, upscaling is enabled up to 2x the original image size. * This is due to Retina / HiDPI-displays, where it can be crisper