定制 avanerk/statamic-image-to-webp 二次开发

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

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

avanerk/statamic-image-to-webp

最新稳定版本:1.2.0

Composer 安装命令:

composer require avanerk/statamic-image-to-webp

包简介

Converts uploaded images to WebP

README 文档

README

This addon automatically converts uploaded images to WebP format, providing smaller file sizes, faster load times, and reduced server bandwidth. It's a simple yet effective solution for developers aiming to improve website performance and SEO without the hassle of manual image optimization.

Installation

You can install the addon via Composer:

composer require avanerk/statamic-image-to-webp

Configuration

After installation, you can publish the configuration file with:

php artisan vendor:publish --tag="image-to-webp-config"

This will create a image-to-webp.php file in your config folder. Here you can specify the file extensions that you would like to convert, whether to remove the original image, and the target queue for the convert image job.

File Extensions

By default, all file extensions will be converted to WebP. If you only want to convert specific file types, you can specify them in a comma-separated list. For example:

'extensions' => 'png, jpeg',

Remove Original Image

By default, the original image will be removed. If you would like to keep the original image, you can set this flag to false.

'remove_original' => false,

Queue

If you use a queue driver other than 'sync' for the convert image job, be aware that the process may take a few seconds, and you might not see the webp image immediately. For some, this delay is not a concern and can be resolved simply by refreshing the browser. However, if you prefer to have the webp image available immediately, set the queue driver for this job to 'sync', which will process the convert job synchronously. Additionally, you have the option to specify the name of the target queue; if not specified, the job will default to the default queue.

'queue' => 'your-queue-name',

Usage

Once configured, the addon will automatically convert uploaded images to WebP format according to your configuration.

Requirements

The GD extension must be installed and compiled with WebP support.

License

This addon is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-30