2017 © Pedro Peláez
 

library imagi-fly

PHP Image Filter library

image

stratease/imagi-fly

PHP Image Filter library

  • Tuesday, December 19, 2017
  • by stratease
  • Repository
  • 5 Watchers
  • 3 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

ImagiFly

PHP Library to process images through any number of filter effects, based on a single source image. Web API Inspired by https://github.com/imsky/holder, (*1)

Makes use of the Intervention Image library for image processing., (*2)

Example

``` html, (*3)

, (*4)

The first portion of the path is the image builder path prepend `/image-builder/` which denotes the remaining portion of the path is to be handled by the parser.

Next is the path to the image `/path/to/my/file.png`. These should typically be a transparent images to allow certain filters to operate appropriately.

And finally there are 2 filters being applied to this image. A special resizing filter `/225x225/` which denotes a 225 pixel width and 225 pixel height, respectively. Followed by `/overlay:2/` an overlay filter, specifying 2 duplicates of the original image to be positioned next to each other.

If we had used an original image of ...

![original file](https://github.com/stratease/ImagiFly/raw/master/demo/images/chipmunks-are-awesome.png)

... after utilizing ImagiFly's filter path, the resulting image would be

![parsed file](https://github.com/stratease/ImagiFly/raw/master/demo/parsed-chipmunk.png)


Setup
-----
Check out our [demo](https://github.com/stratease/ImagiFly/tree/master/demo) to see an example setup.

It's important to note that on the backend we have a server directive to route to our PHP image builder file based on the `/image-builder/...` path.

This will provide a level of overhead for each requested image, and is not recommended for very high traffic sites. We do provide a level of caching to avoid redundant image processing.

Our .htaccess for apache
``` apache

RewriteEngine On
RewriteRule ^image-builder/.*$ image-builder.php [NC,L]

This redirects to our backend script that handles the route parsing and image manipulation., (*5)

``` php, (*6)

use stratease\ImagiFly\Builder; use stratease\ImagiFly\RequestParser; require_once("../vendor/autoload.php"); require_once("PinkFilter.php");, (*7)

$builder = new Builder(['baseDirectory' => DIR.'/images/', // Path where we store base images. Can be in web directory or any location 'cache' => false, // Lets disable the cache so we can see our PinkFilter adjustments per request. // Our request parser. You can provide your own by implementing the RequestParserInterface 'requestParser' => new RequestParser(['requestPath' => $_SERVER['REQUEST_URI'], 'pathPrepend' => 'image-builder'])]);, (*8)

// this is how we register a custom filter, in our case an awesome PinkFilter $builder->addFilterExtension(PinkFilter::getFilterMask(), new PinkFilter());, (*9)

$builder->output(); // This will compile and output the image., (*10)

// Try this path.. /image-builder/chipmunks-are-awesome.png/225x225/overlay:2/pink:unicorn/ // it'll blow your mind!, (*11)

```, (*12)

This implementation also has an example of how to setup a custom filter. Refer to the FilterInterface for further documentation., (*13)

The Versions

19/12 2017

dev-master

9999999-dev

PHP Image Filter library

  Sources   Download

The Requires

 

19/12 2017

v0.2.7

0.2.7.0

PHP Image Filter library

  Sources   Download

The Requires

 

22/07 2014

v0.2.6

0.2.6.0

PHP Image Filter library

  Sources   Download

The Requires

 

10/07 2014

v0.2.5

0.2.5.0

PHP Image Filter library

  Sources   Download

The Requires

 

19/06 2014

v0.2.4

0.2.4.0

PHP Image Filter library

  Sources   Download

The Requires

 

13/06 2014

v0.2.3

0.2.3.0

PHP Image Filter library

  Sources   Download

The Requires

 

13/06 2014

v0.2.2

0.2.2.0

PHP Image Filter library

  Sources   Download

The Requires

 

10/06 2014

v0.2.1

0.2.1.0

PHP Image Filter library

  Sources   Download

The Requires

 

10/06 2014

v0.2

0.2.0.0

PHP Image Filter library

  Sources   Download

The Requires