Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small non-breaking fixes, PSR formatted code, merged many other branches. #17

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
> *NOTE: This is a fork of [Clément Guillemain](https://github.com/Sybio)'s nice [GifCreator class](https://github.com/Sybio/GifCreator), with some minor bug fixes and most pull requests merged together.

# ================================
# GifCreator
# ================================
Expand All @@ -13,7 +15,7 @@ This class helps you to create an animated GIF image: give multiple images and t
**1 - Creation:**

```php
// Create an array containing file paths, resource var (initialized with imagecreatefromXXX),
// 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(
Expand All @@ -23,11 +25,11 @@ $frames = array(
'http://thisisafakedomain.com/images/pic4.jpg', // URL
);

// Create an array containing the duration (in millisecond) of each frames (in order too)
// Create an array containing the duration (in centiseconds (hundredths of a second)) of each frames (in order too)
$durations = array(40, 80, 40, 20);

// Initialize and create the GIF !
$gc = new GifCreator();
$gc = new GifCreator\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.
Expand Down Expand Up @@ -59,9 +61,9 @@ file_put_contents('/myfolder/animated_picture.gif', $gifBinary);
### 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
- 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: https://github.com/Sybio/ImageWorkshop

### About

The class reuses some part of code of "GIFEncoder.class.php" by László Zsidi (thanks to him).
The class reuses some part of code of "GIFEncoder.class.php" by László Zsidi (thanks to him).
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "sybio/gif-creator",
"name": "moroz1999/gif-creator",
"type": "library",
"description": "PHP class that creates animated GIF from multiple images",
"keywords": ["gif", "animated", "creation", "encode", "PHP"],
Expand All @@ -13,9 +13,10 @@
}
],
"require": {
"php": ">=5.3.0"
"php": "^8.0",
"ext-gd": "*"
},
"autoload": {
"psr-0": { "GifCreator": "src" }
}
}
}
Loading