visualweber / image-workshop
使用GD库的强大PHP类,可以轻松处理图像,包括图层概念(类似于Photoshop或GIMP)
Requires
- php: >=5.3.0
- ext-exif: *
- ext-gd: *
Requires (Dev)
- phpunit/phpunit: ~4.5
This package is not auto-updated.
Last update: 2024-09-23 06:11:32 UTC
README
ImageWorkshop类
================================
摘要和功能
非常灵活且易于使用的PHP类,使用GD库处理图像
最新更新
版本 2.0.9 - 2015-07-05
- 修复ImageWorkshop::initFromPath与远程URL的问题
版本 2.0.8 - 2015-06-01
- 修复文件未找到时的异常代码
版本 2.0.7 - 2015-03-22
- 允许
ImageWorkshop::initFromPath
工厂与远程URL一起工作 - 改进PHP >= 5.5兼容性
- 为图层添加
fixOrientation
方法,根据EXIF方向数据更改图像方向 - 修复当值设置为"000000"时的背景色
版本 2.0.6 - 2014-08-01
@jasny (https://github.com/jasny) 贡献,新方法
ImageWorkshopLayer::resizeToFit()
调整图像大小以适应边界框。ImageWorkshopLayer::cropToAspectRatio()
裁剪到文档的宽或高以匹配宽高比。
文档在此:Sybio/ImageWorkshop#37 (评论)
版本 2.0.5 - 2013-11-12
- 在save()方法中实现交错模式(https://php.ac.cn/manual/en/function.imageinterlace.php),以显示渐进式JPEG图像
$interlace = true; // set true to enable interlace, false by default $layer->save($dirPath, $filename, $createFolders, $backgroundColor, $imageQuality, $interlace);
感谢 @dripolles (https://github.com/dripolles) & @johnhunt (https://github.com/johnhunt)
版本 2.0.4 - 2013-09-11
- 修复一个主要错误:当调整两侧大小并保持比例时:图层堆叠问题(当前层在其堆栈中有一个新的嵌套级别,不符合预期),以及使用positionX和positionY的翻译是错误的。已修复。(初始问题:Sybio/ImageWorkshop#14)
- 为clearStack()方法添加一个参数
版本 2.0.2 - 2013-06-14
- 修复一个新错误:当调整大小或裁剪时,小图像可以有0像素的宽度和高度(由于舍入),这是不可能的,脚本会崩溃。现在宽度和高度至少为1像素。
注意
$layer->resizeInPixel(null, 0 /* or negative number */, null);
它将生成一个1像素高的图像,而不是0。
版本 2.0.1 - 2013-06-03
- 修复一个透明度错误:纯黑色颜色(#000000)始终显示为完全透明(从0到99%不透明度)。错误已修复!(不再有已知的错误)
- 添加一些异常以帮助调试
版本 2.0.0 - 2012-11-21
ImageWorkshop的新版本!现在库已分为3个主要类,以实现代码整洁
- ImageWorkshopLayer:表示图层的类,您对其进行操作
- ImageWorkshop:用于生成图层的工厂
- ImageWorkshopLib:包含一些工具(用于计算等...)的类,由这两个类使用
技术上,与1.3.x版本相比,只有初始化方式有所改变,请参阅文档:http://phpimageworkshop.com/documentation.html#chapter-initialization-of-a-layer
以下是一个示例,展示之前和现在的情况
// before $layer = new ImageWorkshop(array( 'imageFromPath' => '/path/to/images/picture.jpg', ));
// now $layer = ImageWorkshop::initFromPath('/path/to/images/picture.jpg');
同时还包括类的安装:http://phpimageworkshop.com/installation.html
文档已更新,您现在可以查看自1.3.3版本以来的每个版本的文档:(例如:http://phpimageworkshop.com/doc/9/initialize-from-an-image-file.html?version=2.0.0,http://phpimageworkshop.com/doc/9/initialize-from-an-image-file.html?version=1.3.3)
安装
该类针对PHP 5.3+设计,但也可以与较旧的PHP版本兼容... 查看如何安装类的说明:http://phpimageworkshop.com/installation.html
用法
- 5分钟内学习如何使用该类:http://phpimageworkshop.com/quickstart.html
- 完整文档:http://phpimageworkshop.com/documentation.html
- 有用的教程:http://phpimageworkshop.com/tutorials.html
文档中的新功能?
- 安装指南:http://phpimageworkshop.com/installation.html
- 添加翻转文档:http://phpimageworkshop.com/doc/25/flip-vertical-horizontal-mirror.html
- 添加遗漏的透明度文档:http://phpimageworkshop.com/doc/24/opacity-transparency.html
- 教程“使用ImageWorkshop管理动画GIF(以及GiFFrameExtractor & GifCreator)”:http://phpimageworkshop.com/tutorial/5/manage-animated-gif-with-imageworkshop.html
@todo
- 添加一个方法,可以轻松地为图层添加边框(外部、内部和中间边框)
- 检查给定的十六进制颜色并移除(如果存在)#。