jensone/image-compressor
最新稳定版本:v1.0.0
Composer 安装命令:
composer require jensone/image-compressor
包简介
A PHP library to compress images using the resmush.it API.
README 文档
README
Image Compressor is a PHP library to compress images via the API resmush.it.
Installation
Install the library via Composer:
composer require jensone/image-compressor
Usage
Compress a local image
use Jensone\ImageOptimizer\ImageOptimizer; $optimizer = new ImageOptimizer(); $optimizedImagePath = $optimizer->compressFile('/path/to/image.jpg');
Compress an image from a URL
use Jensone\ImageOptimizer\ImageOptimizer; $optimizer = new ImageOptimizer(); $optimizedImagePath = $optimizer->compressFromUrl('https://example.com/image.jpg');
Options
You can pass an array of options to the constructor:
use Jensone\ImageOptimizer\ImageOptimizer; $optimizer = new ImageOptimizer([ 'quality' => 92, 'timeout' => 30 ]);
The available options are:
quality: the quality of the compressed image (default: 92)timeout: the timeout in seconds for the API call (default: 30)
License
Image Optimizer is licensed under the MIT License. See the LICENSE file for more information.
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-08
