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.
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).
/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).Glide::url('path.jpg', ['w' => 200], true) or SignedUrl middleware (\League\Glide\Http\Middleware\BuildSignature) to prevent DoS by unbounded image manipulation.@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(...))).s3://, local://). Configure source/target disks in Image::configure([...]) or via League\Glide\Factories\ServerFactory::create() DI pattern.Server::makeImage($source, $params) + saveCacheFile() to avoid runtime generation on first request.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.local) has correct root path and write permissions, especially in Docker or deployed environments.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.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('.').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().How can I help you explore Laravel packages today?