PHP code example of grandt / phpresizegif

1. Go to this page and download the library: Download grandt/phpresizegif library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

grandt / phpresizegif example snippets



     .
    .


use grandt\ResizeGif\ResizeGif;

$srcFile = "[path to original gif file]";
$dstFile = "[path to resized file]";

ResizeGif::ResizeToWidth($srcFile, $dstFile, 100);

ResizeGif::ResizeToWidth($srcFile, $dstFile, 100);

ResizeGif::ResizeToHeight($srcFile, $dstFile, 100);

ResizeGif::ResizeByRatio($srcFile, $dstFile, 2.0);

ResizeGif::ResizeByRatio($srcFile, $dstFile, 0.5);

php -r "readfile('https://getcomposer.org/installer');" | php

php composer.phar install