From e75bad5116d7d33454f4c2c0d6dd40d9c1dad5af Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Thu, 4 Jan 2024 12:50:59 +0100 Subject: [PATCH] Add readme info --- README.md | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 66498cf..89ec3ff 100755 --- a/README.md +++ b/README.md @@ -5,9 +5,17 @@ ![build](https://github.com/Intervention/gif/actions/workflows/build.yml/badge.svg) [![Monthly Downloads](https://img.shields.io/packagist/dm/intervention/gif.svg)](https://packagist.org/packages/intervention/gif/stats) +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 therefore depend on +the GD library. + ## Installation -You can install this package easily with [Composer](https://getcomposer.org/). Just require the package with the following command: +You can easily install this package using [Composer](https://getcomposer.org). +Just request the package with the following command: ```bash composer require intervention/gif @@ -21,7 +29,7 @@ composer require intervention/gif use Intervention\Gif\Decoder; // Decode filepath to Intervention\Gif\GifDataStream::class -$gif = Decoder::decode('/images/animation.gif'); +$gif = Decoder::decode('images/animation.gif'); // Decoder can also handle binary content directly $gif = Decoder::decode($contents); @@ -34,12 +42,8 @@ Use the Builder class to create a new GIF image. ```php use Intervention\Gif\Builder; -// create an empty canvas -$width = 32; -$height = 32; - -// create new gif with width/height -$gif = Builder::canvas($width, $height); +// 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 @@ -48,10 +52,10 @@ $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'); +$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);