nathanward/image-compression

laravel 的图像压缩包。

dev-master 2018-09-16 23:26 UTC

This package is not auto-updated.

Last update: 2024-09-25 10:10:43 UTC


README

安装步骤

  1. composer require nathanward/image-compression
  2. composer require tinify/tinify
  3. 发布配置文件 php artisan vendor:publish
  4. TINIFY_KEY 添加到 .env 文件

示例用法

    use NathanWard\ImageCompression\ImageCompression;

    public function store(Request $request)
    {
        $file = $request->file;

        $path = (new ImageCompression($file))
            ->compress()
            ->store($file->getClientOriginalName(), 'files');

        return redirect()
            ->back()
            ->with('success', 'Image compressed and stored.');
    }

待办事项

  1. 编写基本测试。
  2. 允许压缩多个图像。
  3. 创建额外的驱动程序。