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 Laravel Package

league/glide-laravel

Laravel adapter for League Glide image server. Easily serve on-the-fly resized, cropped, and optimized images using Glide within Laravel. Install via Composer and configure Glide to handle image requests with caching and storage support.

View on GitHub
Deep Wiki
Context7

Getting Started

Install via composer require league/glide-laravel, then register the service provider automatically (Laravel ≥5.5) or manually in config/app.php. Configuration is minimal: publish config via php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravel" --tag=config — wait, no: Glide Laravel doesn’t ship its own config; instead, it relies on intervention/image config (config/image.php) and environment variables like GLIDE_SOURCE, GLIDE_TARGET, and GLIDE_SECRET. Begin with setting GLIDE_SOURCE to your source disk (e.g., public), GLIDE_TARGET to your transform disk (e.g., public), and GLIDE_SECRET (a shared secret for signed URLs). First use case: serve responsive images on a Blade template using signed URLs like {{ Glide::url('original.jpg', ['w' => 300]) }} via the Glide Facade (aliased as Intervention\Image\Facades\Image by default if intervention/image is used).

Implementation Patterns

  • Route-based routes: Let Glide handle all /images/{path} requests by routing through GlideController@show. Define a wildcard route: Route::get('/images/{path}', '\League\Glide\Http\Controllers\ServerController@show')->where('path', '.*');. Configure source/target filesystems in .env or config/image.php (via intervention/image integration).
  • Signed URLs for security: In production, always use Glide::url('path.jpg', ['w' => 200], true) or SignedUrl middleware (\League\Glide\Http\Middleware\BuildSignature) to prevent DoS by unbounded image manipulation.
  • Blade macros & helpers: Extend Blade with macros like @glide('path', ['w' => 400, 'h' => 300, 'fit' => 'crop']) for DRY image rendering, and store final URLs in cache (e.g., via cache()->remember('glide:'.$key, 60, fn() => Glide::url(...))).
  • Disk abstraction: Use Flysystem disks (e.g., s3://, local://). Configure source/target disks in Image::configure([...]) or via League\Glide\Factories\ServerFactory::create() DI pattern.
  • Pre-warming: In deployment pipelines, generate resized versions ahead of time with a console command using Server::makeImage($source, $params) + saveCacheFile() to avoid runtime generation on first request.

Gotchas and Tips

  • Conflicting intervention/image integration: league/glide-laravel works through intervention/image, so ensure intervention/image is installed and properly configured; misconfigured config/image.php is the #1 source of “images not rendering” bugs.
  • Cache path gotcha: Glide caches transformed images relative to the target path, not absolute filesystem paths — ensure your disk driver (e.g., local) has correct root path and write permissions, especially in Docker or deployed environments.
  • Missing GLIDE_SECRET in production: Without a secret, anyone can generate arbitrary image URLs and exhaust server memory. Always set GLIDE_SECRET and enable signature validation via middleware or Server::setRequest() + Server::response.
  • Route conflict with Laravel’s storage/app/public symlink: If using php artisan storage:link, verify your GLIDE_TARGET disk points to storage/app/public after symlink resolution; double-check with Storage::disk('public')->path('.').
  • Extensibility: Override behavior via custom ServerFactory, SourceRepositoryInterface, or ResponseFactory. For example, inject custom cache drivers (Cache::driver('redis')) or modify transformations per user role using middleware that alters request parameters before passing to Server::getImageResponse().
  • No updates since 2015: Despite low stars and no recent releases, it’s stable and widely used in legacy apps. For new apps, consider spatie/image or direct Glide usage — but if integrating with an older Laravel codebase, this remains fully functional with minor tweaks.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport