Kokil / laravel-glide

Optimize your images on the fly with Glide for Laravel.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Glide for Laravel

Optimize your images on the fly with Glide for Laravel.

Support us

Like our work? You can support us by purchasing one of our products.

Installation

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

Usage

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.

Helper

glide('my-image.png', [
    'w' => 1280,
    'h' => 640,
    'q' => 80,
]);

View all available params here.

Blade component

<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.

Config

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',

    ],
];

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Optimize your images on the fly with Glide for Laravel.

License:MIT License


Languages

Language:PHP 91.8%Language:Blade 8.2%