ycs77/laravel-glide

Laravel 的 Glide 图像处理。

v2.0.1 2022-04-13 15:40 UTC

This package is auto-updated.

Last update: 2024-09-13 20:57:27 UTC


README

Latest Version on Packagist Software License Style CI Build Status Total Downloads

Glide 图像处理 for Laravel。

安装

通过 Composer 安装

composer require ycs77/laravel-glide

发布配置

php artisan vendor:publish --provider="Ycs77\LaravelGlide\GlideServiceProvider"

设置 Glide 路由

routes/web.php

use Ycs77\LaravelGlide\Facades\Glide;

// Other routes ...

Glide::route();

用法

glide_url('avatar/user01-avatar.png', [
    'w' => '50',
    'h' => '50',
    'fit' => 'crop',
]);

// https://example.test/img/avatar/user01-avatar.png/sds4d524g.../sd2g4e1drf2g...img.jpg?w=50&h=50&fit=crop

或者使用 Facade

use Ycs77\LaravelGlide\Facades\Glide;

Glide::url('avatar/user01-avatar.png', [
    'w' => '50',
    'h' => '50',
    'fit' => 'crop',
]);

// https://example.test/img/avatar/user01-avatar.png/sds4d524g.../sd2g4e1drf2g...img.jpg?w=50&h=50&fit=crop

完整文档访问:https://glide.thephpleague.com/