2017 © Pedro Peláez
 

library lib-image

Image processing library of the Ride framework

image

ride/lib-image

Image processing library of the Ride framework

  • Thursday, September 8, 2016
  • by ride-user
  • Repository
  • 8 Watchers
  • 0 Stars
  • 3,432 Installations
  • PHP
  • 9 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 23 Versions
  • 2 % Grown

The README.md

Ride: Image Library

Image processing library of the PHP Ride framework., (*1)

You need GD or Imagick on your server to use this library., (*2)

What's In This Library

Image

The Image interface is the base of this library., (*3)

Through this interface, you can: - read and write images - get information about your image like the dimension - basic manipulations like resizing and cropping, (*4)

The DrawImage interface extends from Image and adds methods to draw points, lines, ... on the image., (*5)

Implementations are available for GD and Imagick., (*6)

ImageFactory

The ImageFactory interface offers a generic way to create the instances needed to work with images., (*7)

A generic implementation is provided through GenericImageFactory., (*8)

Point

The Point interface is to define a coordinate on an X-Y axis. It's used for image manipulations. A point can go positive or negative on an axis., (*9)

A generic implementation is provided through GenericPoint., (*10)

Dimansion

The Dimension interface defines a dimension of an image or manipulation., (*11)

A generic implementation is provided through GenericDimension., (*12)

Transformation

The Transformation interface offers a way to apply batch image manipulations., (*13)

There are implementations available for crop, resize, flip, blur, grayscale, watermark and chain manipulations., (*14)

Blur

Blurs your image., (*15)

This transformation has following options:, (*16)

  • radius: optional and defaults to 10

Crop

Crops your image by resizing it first to an optimal dimension., (*17)

This transformation requires the following options:, (*18)

  • width: width to crop to in pixels
  • height: height to crop to in pixels

Flip

Flips your image over the X-axis and/or the Y-axis., (*19)

This transformation requires the following options:, (*20)

  • mode: can be horizontal, vertical or both.

Grayscale

Converts your image to a grayscaled image., (*21)

This transformations has no options., (*22)

Resize

Resizes your image to fit a maximum width and/or height., (*23)

This transformation requires one of the following options:, (*24)

  • width: maximum width of the resulting image
  • height: maximum height of the resulting image

Watermark

Adds a watermark to your image., (*25)

This transformation has the following options:, (*26)

  • x: Point on the X-axis, defaults to 0
  • y: Point on the Y-axis, defaults to 0
  • watermark: relative path to the watermark image

Optimizer

The Optimizer interface can be used to implement optimalizations on image files. It's intented to optimize the file sizes but can be used for other purposes as well., (*27)

A generic implementation is provided through GenericOptimizer., (*28)

GenericOptimizer

The generic image optimizer uses the following binaries on your system: - pngcrush - optipng - jpegoptim - jpegtran (libjpeg-turbo-progs or libjpeg-progs) - gifsicle, (*29)

Note: Unexistant binaries are ignored., (*30)

NullOptimizer

No optimization is performed by this optimizer., (*31)

Color

The Color interface offers an easy way to work with colors., (*32)

The interface is currently implemented for the RGB and the HSL color model., (*33)

ColorScheme

The ColorScheme interface is to generate a number of colors for a specified base color., (*34)

The interface is currently implemented for monochomatic and complementary schemes., (*35)

Code Sample

Check this code sample to see the possibilities of this library:, (*36)

<?php

use ride\library\image\exception\ImageException;
use ride\library\image\GenericImageFactory;
use ride\library\image\Image;
use ride\library\system\file\File;

function foo(File $file) {
    // create an image factory, this one uses GD
    $imageFactory = new GenericImageFactory('gd');

    // use the image factory to create an image
    $image = $imageFactory->createImage();

    try {
        // read an image file
        $image->read($file);
    } catch (ImageException $exception) {
        // file could not be read or invalid image
        return false;
    }

    // get some properties of the image
    $hasTransparancy = $image->hasAlphaTransparancy();
    $transparentColor = $image->getTransparentColor();
    $dimension = $image->getDimension();

    $dimension->getWidth();
    $dimension->getHeight();

    // do some manipulations
    $dimension = $dimension->setWidth($dimension->getWidth() / 2);
    $image = $image->resize($dimension);

    $dimension = $dimension->setHeight($dimension->getHeight() / 2);
    $image = $image->crop($dimension);

    $image = $image->flip(Image::MODE_HORIZONTAL);
    $image = $image->rotate(90);
    $image = $image->blur();
    $image = $image->convertToGrayscale();

    // write the result back to the file
    $image->write($file);
}

Implementations

For more examples, you can check the following implementation of this library: - ride/web-image, (*37)

Installation

You can use Composer to install this library., (*38)

composer require ride/lib-image

The Versions

08/09 2016

dev-master

9999999-dev

Image processing library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

08/09 2016

dev-develop

dev-develop

Image processing library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

08/09 2016

1.0.1

1.0.1.0

Image processing library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

26/07 2016

1.0.0

1.0.0.0

Image processing library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

04/05 2016

0.10.0

0.10.0.0

Image processing library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

19/11 2015

0.8.0

0.8.0.0

Image processing library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

23/10 2015

0.7.1

0.7.1.0

Image processing library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

09/04 2015

0.7.0

0.7.0.0

Image processing library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

16/10 2014

0.6.5

0.6.5.0

Image processing library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

09/10 2014

0.6.4

0.6.4.0

Image processing library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

09/10 2014

0.6.3

0.6.3.0

Image processing library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

30/09 2014

0.6.2

0.6.2.0

Image processing library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

25/09 2014

0.6.1

0.6.1.0

Image processing library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

25/09 2014

0.6.0

0.6.0.0

Image processing library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

19/08 2014

0.5.2

0.5.2.0

Image processing library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

05/08 2014

0.5.1

0.5.1.0

Image processing library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

29/07 2014

0.5.0

0.5.0.0

Image processing library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

11/02 2014

0.4.2

0.4.2.0

Image processing library of the Pallo framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

24/01 2014

0.4.1

0.4.1.0

Image processing library of the Pallo framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

24/01 2014

0.4.0

0.4.0.0

Image processing library of the Pallo framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

23/01 2014

0.3.0

0.3.0.0

Image processing library of the Pallo framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

15/11 2013

0.2.0

0.2.0.0

Image processing library of the Pallo framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

07/11 2013

0.1.0

0.1.0.0

Image processing library of the Pallo framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd