Optimize your images on the fly with Glide for Laravel.
Like our work? You can support us by purchasing one of our products.
You can install the package via composer:
composer require flowframe/laravel-glide
You can easily publish the config like so:
php artisan vendor:publish --tag=glide-config
Once you've installed the package you can use the helper or Blade component. Be aware, we'll try to locate your image from the storage/app
directory.
glide('my-image.png', [
'w' => 1280,
'h' => 640,
'q' => 80,
]);
View all available params here.
<x-glide::image
src="my-image.png"
width="1280"
height="640"
quality="80"
alt="My image"
fit="contain"
format="jpg"
:params="[
// ... glide params
]"
/>
We automatically transform the blade attributes to their respective Glide counterparts.
View all available params here.
The server_config
follows the regular config provided by League\Glide\ServerFactory
. The only difference is that we've prepared it work with Laravel out of the box.
return [
'server_config' => [
'cache_path_prefix' => '.glide-image-cache',
'base_url' => 'glide-image',
],
];
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.