2017 © Pedro Peláez
 

library gif

Native PHP GIF Encoder/Decoder for GD library

image

intervention/gif

Native PHP GIF Encoder/Decoder for GD library

  • Sunday, October 4, 2015
  • by olivervogel
  • Repository
  • 2 Watchers
  • 16 Stars
  • 941 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 4 Forks
  • 2 Open issues
  • 2 Versions
  • 12 % Grown

The README.md

Intervention GIF

Native PHP GIF Encoder/Decoder

Latest Version build Monthly Downloads Support me on Ko-fi, (*1)

Intervention GIF is a PHP encoder and decoder for the GIF image format that does not depend on any image processing extension., (*2)

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., (*3)

The library is the main component of Intervention Image for processing animated GIF files with the GD library, but also works independently., (*4)

Installation

You can easily install this package using Composer. Just request the package with the following command:, (*5)

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., (*6)

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.1

Development & Testing

With this package comes a Docker image to build a test suite and analysis container. To build this container you have to have Docker installed on your system. You can run all tests with this command., (*7)

docker-compose run --rm --build tests

Run the static analyzer on the code base., (*8)

docker-compose run --rm --build analysis

Authors

This library is developed and maintained by Oliver Vogel, (*9)

Thanks to the community of contributors who have helped to improve this project., (*10)

License

Intervention GIF is licensed under the MIT License., (*11)

The Versions

04/10 2015

dev-master

9999999-dev https://github.com/intervention/gif

Native PHP GIF Encoder/Decoder for GD library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

gif image gd animation

08/09 2015

0.5.0

0.5.0.0 https://github.com/intervention/gif

Native PHP GIF Encoder/Decoder for GD library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

gif image gd animation