2017 © Pedro Peláez
 

library image

Image processor

image

thapp/image

Image processor

  • Monday, September 12, 2016
  • by iwyg
  • Repository
  • 2 Watchers
  • 2 Stars
  • 513 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 1 % Grown

The README.md

Image processing

Build Status Code Climate Coverage Status HHVM Status Latest Stable Version Latest Unstable Version License, (*1)

This module was created for the usage in Thapp\JitImage, but can be used as a standalone library for manipulating images. It's highly inspired by the Imagine library, but resolves a views flaws, but also way more limited., (*2)

Installation

Require thapp/image in your project directory, (*3)

$ composer require thapp/image

or add this to your composer.json, (*4)

{
    "require": {
        "thapp/image": "dev-master"
    }
}

Usage

Quick Example

<?php

use Thapp\Image\Geometry\Size;
use Thapp\Image\Driver\Imagick\Source;

$source = new Source;
$image = $source->load('image.jpg');

$image->edit()->crop(new Size(100, 100));

$image->save('newimage.jpg');

Loading sources

The Source object is able to create Image instances from either filepaths, filehandles, or binary strings:, (*5)

<?php

use Thapp\Image\Driver\Imagick\Source;

$source = new Source;
$image = $source->load('image.jpg');
// or read the file from a file handle:
$handle = fopen('image.jpg', 'r+');
$image = $source->read($handle);
// or read the file from a binary string:
$content = file_get_contents('image.jpg');
$image = $source->create($content);

The Source class takes an instance of Thapp\Image\Info\MetaDataReaderInterface as its first argument. The $reader is used to read meta information about the image. This is useful e.g. if you want to autorotate the image based on its orientation., (*6)

By default, a new instance of Thapp\Image\Info\ImageReader is created for you. ImageReader is capable of reading basic image information derived from the php getimagesize() function., (*7)

You may use the Thapp\Image\Info\ImageReader class instead, which provides a wider range of information (e.g. needed for GD and Gmagick drivers to determine the correct image orientation)., (*8)

<?php

use Thapp\Image\Info\ExifReader;
use Thapp\Image\Driver\Imagick\Source;

$source = new Source(new ExifReader);

// ...

$image = $source->load('image.jpg');

The Versions

12/09 2016

dev-develop

dev-develop

Image processor

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

by Avatar iwyg

image gd imagick imagemagick

30/01 2015

dev-master

9999999-dev

Image processor

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Avatar iwyg

29/01 2015

v1.0.0beta1

1.0.0.0-beta1

Image processor

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Avatar iwyg

17/07 2014

dev-development

dev-development

Image processing library

  Sources   Download

The Requires

 

The Development Requires

by Avatar iwyg