halilbelkir / img-webp-convert
这是一个在 Laravel 中使用的 HTML 标签 'img' 的创建库,可以将 jpg、png 等图像格式转换为 webp 格式。
1.2.29
2024-04-04 19:13 UTC
Requires
- php: ^7.3|^8.0|^9.0
- illuminate/support: ^7|^8|^9|^10
README
这是一个在 Laravel 中使用的 HTML 标签 'img' 的创建库,可以将 jpg、png 等图像格式转换为 webp 格式。 ** https://packagist.org.cn/packages/halilbelkir/img-webp-convert
所需安装
- Composer 已安装
- 安装 Laravel
安装
composer require halilbelkir/img-webp-convert
php artisan vendor:publish --provider="halilBelkir\WebConvert\WebpConvertServiceProvider" --force
文件系统设置
在 config/filesystem 中 disks 数组的子目录下添加以下数组。
'cache' => [ 'driver' => 'local', 'root' => public_path() . '/upload/cache', 'url' => '/upload/cache', ],
配置 App
在 config/app 中的 aliases 数组的子目录下添加以下定义。
"WebpConvert" => halilBelkir\WebConvert\ImageHelper::class
使用方法
{!! WebpConvert::createTag(resim yolu,['width' =>[1440,768,500], 'height' => [500,400,400]],['alt' => 'alt','title' => 'title','class' => 'class adı'],'lazy load kullanılacak ise buraya sadece "lazy" yazmanız yeterlidir','resmin yeni adı',1 olursa başka domainden kendi dosyanıza indirir ) !!}
第 2 种使用方法
{!! WebpConvert::getImage(resim yolu,width,height,resmin yeni adı,1 olursa başka domainden kendi dosyanıza indirir) !!}