2017 © Pedro Peláez
 

library gif-create

Easy way to create gif animations from png images.

image

pomirleanu/gif-create

Easy way to create gif animations from png images.

  • Friday, October 21, 2016
  • by pomirleanu
  • Repository
  • 2 Watchers
  • 0 Stars
  • 661 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 5 Versions
  • 45 % Grown

The README.md

gif-create

Latest Version on Packagist ![Software License][ico-license] Build Status ![Coverage Status][ico-scrutinizer] Quality Score ![Total Downloads][ico-downloads], (*1)

Easy way to create gif animations from png images for laravel 5.*., (*2)

Install

Via Composer, (*3)

``` bash $ composer require pomirleanu/gif-create, (*4)


### Usage basic php **1. Inputs:** ```php // Use an array containing file paths, resource vars (initialized with imagecreatefromXXX), // image URLs or binary image data. $frames = array( imagecreatefrompng("/../images/pic1.png"), // resource var "/../images/pic2.png", // image file path file_get_contents("/../images/pic3.jpg"), // image binary data "http://thisisafakedomain.com/images/pic4.jpg", // URL ); // Or: load images from a dir (sorted, skipping .files): //$frames = "../images"; // Optionally: set different durations (in 1/100s units) for each frame $durations = array(20, 30, 10, 10); // Or: you can leave off repeated values from the end: //$durations = array(20, 30, 10); // use 10 for the rest // Or: use 'null' anywhere to re-apply the previous delay: //$durations = array(250, null, null, 500);

2. Create the GIF:, (*5)

``` php use Pomirleanu\GifCreate;, (*6)

// ..., (*7)

$gif = new GifCreate\GifCreate(); $gif->create($frames, $durations);, (*8)

// Or: using the default 100ms even delay: //$gif->create($frames);, (*9)

// Or: loop 5 times, then stop: //$gif->create($frames, $durations, 5); // default: infinite looping, (*10)


**3. Get/use the result:** You can now get the animated GIF binary: ```php $gif = $gif->get();

...and e.g. send it directly to the browser:, (*11)

header("Content-type: image/gif");
echo $gif;
exit;

Or just save it to a file:, (*12)

$gif->save("animated.gif");

Usage in laravel 5.*

Service provider should be :, (*13)

Pomirleanu\GifCreate\GifCreateServiceProvider::class,

Publish needed assets (config file) :, (*14)

php artisan vendor:publish --provider="Pomirleanu\GifCreate\GifCreateServiceProvider"

Note: Composer won't update them after composer update, you'll need to do it manually!, (*15)

Behavior

  • Transparency is based on the first frame. [!!NOT VERIFIED: "It will be saved only if you give multiple frames with the same transparent background"]
  • The dimensions of the generated GIF are based on the first frame, too. If you need to resize your images to get the same dimensions, you can use this class: https://github.com/Sybio/ImageWorkshop.

Dependencies

  • PHP 5.3 (for namespace support & whatnot; noone still shamelessly uses PHP < 5.3, right?!)
  • GD (imagecreatefromstring, imagegif, imagecolortransparent)

Contributing

Please see CONTRIBUTING and CONDUCT for details., (*16)

Security

If you discover any security related issues, please email pomirleanu.florentin@gmail.com instead of using the issue tracker., (*17)

Credits

License

The MIT License (MIT). Please see License File for more information., (*18)

The Versions

21/10 2016

dev-master

9999999-dev https://github.com/pomirleanu/gif-create

Easy way to create gif animations from png images.

  Sources   Download

MIT

The Requires

 

The Development Requires

pomirleanu gifcreate

21/10 2016

v1.3

1.3.0.0 https://github.com/pomirleanu/gif-create

Easy way to create gif animations from png images.

  Sources   Download

MIT

The Requires

 

The Development Requires

pomirleanu gifcreate

17/10 2016

v1.2

1.2.0.0 https://github.com/pomirleanu/gif-create

Easy way to create gif animations from png images.

  Sources   Download

MIT

The Requires

 

The Development Requires

pomirleanu gifcreate

26/09 2016

v1.1

1.1.0.0 https://github.com/pomirleanu/gif-create

Easy way to create gif animations from png images.

  Sources   Download

MIT

The Requires

 

The Development Requires

pomirleanu gifcreate

26/09 2016

v1.0

1.0.0.0 https://github.com/pomirleanu/gif-create

Easy way to create gif animations from png images.

  Sources   Download

MIT

The Requires

 

The Development Requires

pomirleanu gifcreate