Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Initial commit
  • Loading branch information
Grandt committed Apr 28, 2015
1 parent d563a79 commit 6751e0e
Show file tree
Hide file tree
Showing 26 changed files with 2,712 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Eclipse files #
#################
.project
.buildpath
.settings
.jsdtscope
org.eclipse.*

# PHPStorm files #
#################
.idea/*

# Composer files #
#################
composer.lock
composer.phar
vendor
vendor/*

# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store?
ehthumbs.db
Icon?
Thumbs.db
/testData


# Test generated files #
#####################################
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Resize animated Gif files


This package aims to implement a proper resizing of gif files encompassing the GIF89a specification.


## Introduction

Most, 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 are 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.

## Usage

The 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.

### Initialization

```php
include "../vendor/autoload.php";
use grandt\ResizeGif\ResizeGif;

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

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

### To make a 100 pixel wide thumbnail

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

### To make a 100 pixel high thumbnail

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

### To double the size of the gif.

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

### To half the size of the gif.

```php
ResizeGif::ResizeByRatio($srcFile, $dstFile, 0.5);
```
4 changes: 4 additions & 0 deletions REVISION.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---------------------------------------------------------------------
Rev. 1.0.0 - 2015-04-27
Initial release
---------------------------------------------------------------------
30 changes: 30 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "grandt/phpresizegif",
"type": "library",
"description": "GIF89a compliant Gif resizer, including transparency and optimized gifs with sub sized elements.",
"keywords": ["gif", "animated gif", "resize", "GIF89a"],
"homepage": "https://github.com/Grandt/PHPResizeGif",
"minimum-stability": "stable",
"license": "LGPL-2.1",
"version": "1.0.0",
"authors": [
{
"name": "A. Grandt",
"email": "[email protected]",
"homepage": "http://grandt.com",
"role": "Developer"
}
],
"require": {
"grandt/binstring": "0.2.0.x-dev",
"php": ">=5.3.0"
},
"autoload": {
"psr-4": {
"grandt\\ResizeGif\\": "src/ResizeGif",
"grandt\\ResizeGif\\Files\\": "src/ResizeGif/Files",
"grandt\\ResizeGif\\Structure\\": "src/ResizeGif/Structure",
"grandt\\ResizeGif\\Debug\\": "src/ResizeGif/Debug"
}
}
}
Loading

0 comments on commit 6751e0e

Please sign in to comment.