定制 dashed/laravel-drift 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dashed/laravel-drift

最新稳定版本:v1.0.19

Composer 安装命令:

composer require dashed/laravel-drift

包简介

README 文档

README

Optimize images on the fly.

Installation

You can install the package via composer:

composer require dashed/laravel-drift

Usage

Simply install the package, and register a configuration in AppServiceProvider@boot:

use Dashed\Drift\Config;
use Dashed\Drift\DriftManager;
use Dashed\Drift\CachingStrategies\FilesystemCachingStrategy;

/** @var DriftManager $drift */
$drift = app(DriftManager::class);

$drift->registerConfig(new Config(
    name: 'my-config-name', // Will be used in the slug
    filesystemDisk: 'filesystems-disk-name', // Local, public or s3 for example
    cachingStrategy: FilesystemCachingStrategy::class, // Create your own or use the defaults like FilesystemCachingStrategy or NullCachingStrategy
));

Image URLs

To generate an image URL use the \Dashed\Drift\UrlBuilder like so:

use Dashed\Drift\UrlBuilder;

/** @var UrlBuilder $builder */
$builder = app(UrlBuilder::class);

$image = $builder->url('my-config-name', 'example.png', [
    'resize' => [1920, 1080],
    'encode' => 'webp', // The fallback encoding will be webp
]);

You can use most of Intervention Image's methods, simply use the method name as key and set the argument as value. Have more than one argument? Use an array instead like in the example above.

Blade Component

<x-drift::image
    class="w-full aspect-[16/9] object-cover"
    config="my-config-name"
    path="example.png"
    :manipulations="[
        'encode' => ['jpeg', 50],
        'greyscale' => true,
    ]"
/>

统计信息

  • 总下载量: 692
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-17