sujan97825/laravel-webp-converter 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

sujan97825/laravel-webp-converter

最新稳定版本:v0.1.1

Composer 安装命令:

composer require sujan97825/laravel-webp-converter

包简介

Convert jpg,jpeg,png,webp image to webp,Compress & Resize Image

README 文档

README

Convert jpg,jpeg,png,webp image to webp,Compress & Resize Image.

Installation

composer require sujan97825/laravel-webp-converter

Configuration

Service Provider Registration In config/app.php, add in providers array -

'providers' => [
    // ...
    Sujan\\LaravelWebpConverter\\WebpConverterServiceProvider::class,
    // ...
],

Facade Class Alias Add in aliases array -

'aliases' => Facade::defaultAliases()->merge([
    // ...
    'WebpConverter' => Sujan\LaravelWebpConverter\Facades\WebpConverter::class,
    // ...
])->toArray(),

Use from Controller

Import first the WebpConverter facade

use Sujan\LaravelWebpConverter\Facades\WebpConverter;

API Docs

Generate method -

WebpConverter::webpImage($file, $filename, $location, $width = null, $height = null, $quality = null);
/**
 * Convert image to webp.
 *
 * @param file $file
 * @param string $filename
 * @param string $location
 * @param integer $width
 * @param integer $height
 * @param integer $quality
 *
 * @return string
 * @throws \Exception
 */
public function webpImage(
    $file,
    $filename,
    $location,
    $width = null
    $height = null
    $quality = null
)

Input Type Demo

  $file = $request->file("image"); //Request File
  $filename="abc"; //Image Name
  $location="assets/images/"; //Image Upload Location
  $width=500; // Image Width,If You Want To Resize.Default Null.
  $height=250; // Image Height,If You Want To Resize.Default Null.
  $quality=100 //Image Quality Can Be Used [ 1-100 ],Default 100.

Publish configuration

php artisan vendor:publish --provider="Sujan\LaravelWebpConverter\WebpConverterServiceProvider"

Configurations

return [
    /*
    |--------------------------------------------------------------------------
    | Default Image  Quality
    |--------------------------------------------------------------------------
    |
    | Default 100, image quality can be used [1-100]
    |
    */
    'quality' => 100,
];

Contribution

You're open to create any Pull request.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固