plutuss / gif-creator-laravel
Laravel GIF animation package - a wrapper for sybio/gif-creator. Easily create, manipulate, and store animated GIFs using Laravel storage and facades.
1.0.0
2025-02-11 11:45 UTC
Requires
- ext-gd: *
This package is auto-updated.
Last update: 2025-04-11 12:09:30 UTC
README
A Laravel wrapper for sybio/gif-creator, providing a convenient way to create GIF animations using the GifCreator
facade and storage. This package does not restrict the standard approach from sybio/gif-creator
.
Installation
Install the package via Composer:
composer require plutuss/gif-creator-laravel
After installation, if you are using Laravel < 5.5, add the service provider and facade to config/app.php
:
'providers' => [ \Plutuss\Gif\Providers\GifCreatorServiceProvider::class, ], 'aliases' => [ 'GifCreator' => \Plutuss\Gif\Facades\GifCreator::class, ],
Usage
Creating a GIF
use Plutuss\Gif\Facades\GifCreator; $gif = GifCreator::storage('public') // You can specify a disk name ->durations([40, 80, 40, 20, 10]) ->frames(['1.jpg', '2.jpg', '3.jpg'], 'images/') // Pass an array of file names and a path if different ->loop() ->makeGif(); // Retrieve binary GIF data $gifData = $gif->getGif(); // Display GIF in the browser $gif->show(); // Save GIF to the server with a specified path and filename $gif->save('gif/', 'animated.gif'); // or // Save GIF to storage Storage::disk('public')->put('animated.gif', $gifData);
Methods
storage(string $disk = null)
– Uses files fromstorage
, allowing a specific disk namedurations(array $durations)
– Sets frame durationsframes(array $files, string $path = '')
– Loads frames from the specified path (pass an array of file names and a path if different)loop(int $count = 0)
– Sets the loop count (default is infinite)makeGif()
– Creates a GIF animationgetGif()
– Retrieves binary GIF datashow()
– Displays GIF in the browsersave(string $path, string $filename)
– Saves the GIF to the server at the specified path
License
This package is licensed under the MIT License.