neutron/silex-imagine-provider

A Silex service provider for Imagine Image Processing Library

Installs: 51 052

Dependents: 4

Stars: 18

Watchers: 3

Forks: 4

Open Issues: 1

Language: PHP

0.1.2 2013-05-03 18:48 UTC

README

Build Status

Usage

use Imagine\Image\Box;
use Neutron\Silex\Provider\ImagineServiceProvider;
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;

$app = new Application();
// detect a driver for you
$app->register(new ImagineServiceProvider());
// OR choose your own driver
$app->register(new ImagineServiceProvider(), array('imagine.driver' => 'Gmagick'));

$app->match('/image-resize', function(Request $request) use ($app) {
    $app['imagine']
            ->open($request->files->get('image')->getPathname())
            ->resize(new Box(320, 240))
            ->save('/path/to/data/image-resized.jpg');

    return 'Image resized !';
});
$app->run();

License

MIT License