Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3) - Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung - Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü - Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person - Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“ - Benutzerverwaltung im Admin, Zugang vorläufig über is_admin - vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/ - PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung - VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
100 lines
2.9 KiB
Markdown
100 lines
2.9 KiB
Markdown
# Intervention GIF
|
|
## Native PHP GIF Encoder/Decoder
|
|
|
|
[](https://packagist.org/packages/intervention/gif)
|
|

|
|
[](https://packagist.org/packages/intervention/gif/stats)
|
|
[](https://ko-fi.com/interventionphp)
|
|
|
|
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](https://github.com/Intervention/image) for processing animated GIF files
|
|
with the GD library, but also works independently.
|
|
|
|
## Installation
|
|
|
|
You can easily install this package using [Composer](https://getcomposer.org).
|
|
Just request the package with the following command:
|
|
|
|
```bash
|
|
composer require intervention/gif
|
|
```
|
|
|
|
## Code Examples
|
|
|
|
### Decoding
|
|
|
|
```php
|
|
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.
|
|
|
|
```php
|
|
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.
|
|
|
|
```bash
|
|
docker-compose run --rm --build tests
|
|
```
|
|
|
|
Run the static analyzer on the code base.
|
|
|
|
```bash
|
|
docker-compose run --rm --build analysis
|
|
```
|
|
|
|
## Authors
|
|
|
|
This library is developed and maintained by [Oliver Vogel](https://intervention.io)
|
|
|
|
Thanks to the community of [contributors](https://github.com/Intervention/gif/graphs/contributors) who have helped to improve this project.
|
|
|
|
## License
|
|
|
|
Intervention GIF is licensed under the [MIT License](LICENSE).
|