michielkempen / laravel-glide
利用Glide在Laravel中执行即时图像处理。
0.3.1
2021-11-29 13:30 UTC
Requires
- php: ^7.1|^8.0
- illuminate/http: ^5.5|^6.0|^7.0|^8.0
- illuminate/support: ^5.5|^6.0|^7.0|^8.0
- league/glide-laravel: ^1.0
README
利用Glide在Laravel中执行即时图像处理。
安装
将包添加到应用的依赖中。
composer require michielkempen/laravel-glide
配置
使用环境变量配置包。
<?php return [ 'source' => [ /* * The filesystem where the original files are stored. */ 'filesystem' => env('GLIDE_SOURCE_FILESYSTEM', 'public'), /* * The path within the filesystem where the original files are stored. */ 'path' => env('GLIDE_SOURCE_PATH', ''), ], 'cache' => [ /* * The filesystem where the manipulated files will be cached. */ 'filesystem' => env('GLIDE_CACHE_FILESYSTEM', 'public'), /* * The path within the filesystem where the manipulated files will be cached. */ 'path' => env('GLIDE_CACHE_PATH', 'cache/'), ], /* * The secret that is used to sign the manipulation requests. */ 'secret' => env('GLIDE_SECRET', 'secret'), /* * The prefix of the original files endpoint. */ 'file_endpoint_prefix' => env('FILE_ENDPOINT_PREFIX', '/storage/'), /* * The prefix of the manipulated files endpoint. */ 'glide_endpoint_prefix' => env('GLIDE_ENDPOINT_PREFIX', '/glide/'), ];
使用方法
以下是一个快速示例,展示如何修改图像
$manipulatedImageUrl = glide($fileName, ['w'=> 50, 'filt'=>'greyscale']);
查看 Glide图像API 了解您可以传递给方法的参数。
许可证
MIT许可证(MIT)。请参阅 许可证文件 获取更多信息。