intervention/gif
Composer 安装命令:
composer require intervention/gif
包简介
PHP GIF Encoder/Decoder
关键字:
README 文档
README
Native PHP GIF Encoder/Decoder
Intervention GIF is a PHP encoder and decoder for the GIF image format that does not depend on any image processing extension.
Only the special Splitter::class class divides the data stream of an animated
GIF into individual GDImage objects for each frame and is therefore dependent
on the GD library.
The library is the main component of Intervention Image for processing animated GIF files with the GD library, but also works independently.
Installation
You can easily install this package using Composer. Just request the package with the following command:
composer require intervention/gif
Code Examples
Decoding
use Intervention\Gif\Decoder; // Decode filepath to Intervention\Gif\GifDataStream::class $gif = Decoder::decode('images/animation.gif'); // Decoder can also handle binary content directly $gif = Decoder::decode($contents);
Encoding
Use the Builder class to create a new GIF image.
use Intervention\Gif\Builder; // create new gif canvas $gif = Builder::canvas(width: 32, height: 32); // add animation frames to canvas $delay = .25; // delay in seconds after next frame is displayed $left = 0; // position offset (left) $top = 0; // position offset (top) // add animation frames with optional delay in seconds // and optional position offset for each frame $gif->addFrame('images/frame01.gif', $delay, $left, $top); $gif->addFrame('images/frame02.gif', $delay, $left); $gif->addFrame('images/frame03.gif', $delay); $gif->addFrame('images/frame04.gif'); // set loop count; 0 for infinite looping $gif->setLoops(12); // encode $data = $gif->encode();
Requirements
- PHP >= 8.3
Development & Testing
With this package comes a Docker docker test runners. To build this container you have to have Docker installed on your system. You can run all tests with this command.
docker-compose run --rm --build tests
Run the static analyzer on the code base.
docker-compose run --rm --build analysis
Authors
This library is developed and maintained by Oliver Vogel
Thanks to the community of contributors who have helped to improve this project.
License
Intervention GIF is licensed under the MIT License.
intervention/gif 适用场景与选型建议
intervention/gif 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 28.68M 次下载、GitHub Stars 达 60, 最近一次更新时间为 2015 年 09 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「image」 「gd」 「gif」 「animation」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 intervention/gif 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 intervention/gif 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 intervention/gif 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Lightweight, cross-browser and highly customizable animated scrolling with jQuery
A reliable and extensible PHP image manipulation library
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
PHP Cli Image - This library converts a given image to ASCII string.
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
Wrapper of spin.js component. An animated CSS3 loading spinner with VML fallback for IE.
统计信息
- 总下载量: 28.68M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 62
- 点击次数: 36
- 依赖项目数: 7
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-08