PHPackages                             lenka-dev/gif-creator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. lenka-dev/gif-creator

ActiveLibrary[Image &amp; Media](/categories/media)

lenka-dev/gif-creator
=====================

PHP class to create an animated GIF from multiple images

v1.0(3y ago)09PHPPHP &gt;=8.1.0

Since Oct 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Lenka-Dev/GifCreator)[ Packagist](https://packagist.org/packages/lenka-dev/gif-creator)[ Docs](https://github.com/Lenka-Dev/GifCreator)[ RSS](/packages/lenka-dev-gif-creator/feed)WikiDiscussions main Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

> *NOTE: This is a fork of [Clément Guillemain](https://github.com/Sybio)'s nice [GifCreator class](https://github.com/Sybio/GifCreator), I changed some functions to work with php8.1, I made it to work in a project.*

### For what ?

[](#for-what-)

This class helps you to create an animated GIF image: give multiple images and their duration and that's it !

### Usage

[](#usage)

**1 - Creation:**

```
// Create an array containing file paths, resource var (initialized with imagecreatefromXXX),
// image URLs or even binary code from image files.
// All sorted in order to appear.
$frames = array(
    imagecreatefrompng("/../images/pic1.png"), // Resource var
    "/../images/pic2.png", // Image file path
    file_get_contents("/../images/pic3.jpg"), // Binary source code
    'http://thisisafakedomain.com/images/pic4.jpg', // URL
);
// Create an array containing the duration (in millisecond) of each frames (in order too)
$durations = array(40, 80, 40, 20);
// Initialize and create the GIF !
$gc = new GifCreator();
$gc->create($frames, $durations, 5);
```

The 3rd parameter of create() method allows you to choose the number of loop of your animated gif before it stops. In the previous example, I chose 5 loops. Set 0 (zero) to get an infinite loop.

**2 - Get the result:**

You can now get the animated GIF binary:

```
$gifBinary = $gc->getGif();
```

Then you can show it in the navigator:

```
header('Content-type: image/gif');
header('Content-Disposition: filename="butterfly.gif"');
echo $gifBinary;
exit;
```

Or save it in a folder as a GIF:

```
file_put_contents('/myfolder/animated_picture.gif', $gifBinary);
```

### Behavior

[](#behavior)

- The transparency is based on the first given frame. It will be saved only if you give multiple frames with same transparent background.
- The dimensions of the generated GIF are based on the first frame. If you need to resize your frames to get the same dimension, you can use this class:

### About

[](#about)

The class reuses some part of code of "GIFEncoder.class.php" by László Zsidi (thanks to him).

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1360d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/157a1ce145b3596fb72ebf0f4e904ffd77326842e0a8c55b4f8753b7e81550d7?d=identicon)[Lenka-Dev](/maintainers/Lenka-Dev)

---

Top Contributors

[![Lenka-Dev](https://avatars.githubusercontent.com/u/115622193?v=4)](https://github.com/Lenka-Dev "Lenka-Dev (1 commits)")

---

Tags

phpencodegifanimatedcreation

### Embed Badge

![Health badge](/badges/lenka-dev-gif-creator/health.svg)

```
[![Health](https://phpackages.com/badges/lenka-dev-gif-creator/health.svg)](https://phpackages.com/packages/lenka-dev-gif-creator)
```

###  Alternatives

[sybio/gif-creator

PHP class that creates animated GIF from multiple images

330410.1k14](/packages/sybio-gif-creator)[lunakid/anim-gif

PHP class to create an animated GIF from multiple images

90137.7k1](/packages/lunakid-anim-gif)[sybio/gif-frame-extractor

PHP class that separates all the frames (and their duration) of an animated GIF

180437.0k9](/packages/sybio-gif-frame-extractor)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
