lireincore/image
Composer 安装命令:
composer require lireincore/image
包简介
Image effects, thumbnails and postprocessing
README 文档
README
About
Supports GD, Imagick and Gmagick.
Also, you can use a special extension lireincore/imgcache that adds the ability to cache thumbs.
Install
Add the "lireincore/image": "^0.3" package to your require section in the composer.json file
or
$ php composer.phar require lireincore/image
Usage
//Use basic effects use LireinCore\Image\Manipulators\Imagine; use LireinCore\Image\PostProcessors\OptiPng; $image = (new Imagine()) ->open('/path/to/image.jpg') ->resize(1000, 500) ->grayscale() ->blur(2) ->text('Hello word', 'Verdana'); ->save('/path/to/new_image.png', ['format' => 'png', 'png_compression_level' => 7]); $postProcessor = new OptiPng(); $postProcessor->process('/path/to/new_image.png'); //optimize image //Also you can add extended effects use LireinCore\Image\Manipulator; use LireinCore\Image\Manipulators\Imagine; use LireinCore\Image\Effects\Overlay; use LireinCore\Image\Effects\ScaleDown; use LireinCore\Image\Effects\Fit; use LireinCore\Image\PostProcessors\JpegOptim; $image = (new Imagine(Manipulator::DRIVER_GD)) ->open('/path/to/image.jpg') ->apply(new Overlay('/path/to/watermark.png', 70, 'right', 'bottom', '50%', '50%')) ->grayscale() ->apply(new ScaleDown('50%', '50%', true)) ->apply(new Fit('center', 'center', '200', '90', '#f00', 20, true)) ->negative() ->save('/path/to/new_image.jpg'); $postProcessor = new JpegOptim(); $postProcessor->process('/path/to/new_image.jpg'); //optimize image
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-04-26