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.
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,
],
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);
storage(string $disk = null) – Uses files from storage, 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 pathThis package is licensed under the MIT License.
How can I help you explore Laravel packages today?