Recommend this page to a friend! |
Classes of Asbjorn Grandt | PHP GIF Resizer | README.md | Download |
|
DownloadResize animated Gif filesThis package aims to implement a proper resizing of gif files encompassing the GIF89a specification. IntroductionMost, if not all other publicly available gif resize packages fails with optimized gif files, those where only parts of the file are updated in subsequent frames. See these as a background image, with sprites moving about. The resulting gif will retain its aspect ratio. The package is a bit pedantic in its approach. It was made as much for me to learn what Gifs were and how they work, as it was to solve specific problem. UsageThe package needs to write to a file, the reasons for not just return a string is twofold. One being memory usage, the other is that you really don't want to be dynamically resizing often used gif files every time they are used. ImportAdd this requirement to your
ComposerIf you already have Composer installed, skip this part. Packagist, the main composer repository has a neat and very short guide. Or you can look at the guide at the Composer site. The easiest for first time users, is to have the composer installed in the same directory as your composer.json file, though there are better options. Run this from the command line:
This will check your PHP installation, and download the Once composer is installed you can create the
Followed by telling Composer to install the dependencies.
this will download and place all dependencies defined in your Finally, you include the
Initialization
To make a 100 pixel wide thumbnail
To make a 100 pixel high thumbnail
To double the size of the gif.
To half the size of the gif.
|