Skip to content
This repository has been archived by the owner on Mar 29, 2020. It is now read-only.

cbrunet/Pitlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Image Transformation Library - Pitlib
http://cbrunet.net/pitlib

- a fork from Asido
Version 0.3.0 alpha

By Charles Brunet <[email protected]>

== INSTALLATION ==

You only need files located into lib/ directory.
Copy them somewhere accessible from your PHP script.

To use Pitlib, simply include Pitlib.php file into your code, e.g.:

 require_once 'Pitlib.php';

You will need some additional programs or libraries to use some Pitlib drivers.

On Debian/Ubuntu, you need:

* php5-gd        : for 'gd' driver;
* netpbm         : for 'netpbm' driver;
* php5-imagick   : for 'imagick_ext' driver;
* imagemagick    : for 'imagick_shell' driver;
* graphicsmagick : for 'gmagick_shell' driver;
* php-imlib      : for 'imlib2' driver. You will also need to load it in php.ini;

For 'magickwand' driver, see below...

== USING PITLIB ==

Example 1: simple image conversion

<?php

// include Pitlib library
require_once 'Pitlib.php';

try {
    // load 'gd' driver.
    // Calling Pitlib::driver (); would try to find best available driver.
    Pitlib::driver ('gd');
    
    // Load source image and set target destination
    $image = Pitlib::image ('source.jpg');
    
    // Perform the operation
    $image->save ('target.png', Pitlib::OVERWRITE_ENABLED);
}
catch (Pitlib_Exception $e) {
    echo $e->getMessage ();
}

?>

== GENERATION DOC ==

To generate API documentation, you need PhpDocumentor. More info at http://www.phpdoc.org

To install PhpDocumentor, you just need to use PEAR

$ pear install PhpDocumentor

To generate documentation, type

$ phpdoc -c doc/default.ini

== TESTING ==

To know what drivers are available on you system, run
$ php Test/driver.php

To run test suite, you will need an installation of PHPUnit.
The easiest way to install PHPUnit is using pear.

$ pear channel-discover pear.phpunit.de
$ pear install phpunit/PHPUnit


To run test suite, simple do

 phpunit Test/phpunit/AllTests.php

from within Pitlib directory. Some tests cannot be executed if specific
drivers cannot be loaded. 


== INSTALLING MagickWand ON UBUNTU ==

$ sudo aptitude install subversion php5-dev  imagemagick php5-imagick libmagick9-dev
$ svn co https://www.imagemagick.org/subversion/MagickWandForPHP/branches/MagickWandForPHP-1.0.8 MagickWandForPHP-1.0.8
$ cd MagickWandForPHP-1.0.8
$ phpize
$ autoconf
$ ./configure
$ make
$ sudo make install

Create file /etc/php5/cond.d/magickwand.ini:
extension=magickwand.so

Restart apache2


About

PHP Image Transformation Library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages