PHP 图像处理类库
一款多功能的PHP图像处理类库,还支持动态gif图像, (*1)
安装
composer require "lshorz/imagelib"
使用例子
thumb(300, 200, null, $img::THUMB_AUTO)->save('uploads/test_thumb.gif');
//缩略图也支持自动计算长,高比例最后生成http响应,例如:
echo $img->thumb(null, 200)->response('gif');
?>
该类库会自动识别图像是否为动态图片, (*2)
更多方法可参见抽像类里面的public方法,或参看相关类里面的方法, (*3)
AbstractImage.php
- ImageCommon.php 对应的是普通图像处理方法
- GifCommon.php 对应的是动态GIF图像处理方法
> ImageCommon.php(普通图像处理方法)会比GifCommon.php(gif处理方法)多出:
> blur() //图像模糊 和 opacity() //透明度
或各种方法的链式操作, (*4)
crop(800, 800, 0, 0)->resize(300, 200, true)->waterMark($warter, $img::POS_BOTTOM_RIGHT)->encode('data-url', 90);
//输出该图像
echo "
";
?>
引用列表
- intervention/image
- Sybio/GifFrameExtractor
- Sybio/GifCreator, (*5)