mews/phpthumb

PHPThumb Package for Laravel 4

dev-master 2014-12-31 13:51 UTC

This package is auto-updated.

Last update: 2024-10-29 04:36:19 UTC


README

A simple Laravel 4 service provider for including the PHPThumb for Laravel 4.

Installation

The PHPThumb Service Provider can be installed via Composer by requiring the mews/phpthumb package and setting the minimum-stability to dev (required for Laravel 4) in your project's composer.json.

{
    "require": {
        "laravel/framework": "4.0.*",
        "mews/phpthumb": "dev-master"
    },
    "minimum-stability": "dev"
}

Update your packages with composer update or install with composer install.

Usage

To use the PHPThumb Service Provider, you must register the provider when bootstrapping your Laravel application. There are essentially two ways to do this.

Find the providers key in app/config/app.php and register the PHPThumb Service Provider.

    'providers' => array(
        // ...
        'Mews\Phpthumb\PhpthumbServiceProvider',
    )

Example

    class ImageController extends Controller {

        public function getIndex()
        {

            $file = base_path() . '/test.jpg';
            //$file = 'http://phpthumb.gxdlabs.com/wp-content/themes/phpthumb/images/header_bg.png';
            App::make('phpthumb')
                ->create('crop', array($file, 'center', 200, 200))
                //->create('crop', array($file, 'basic', 100, 100, 300, 200))
                //->create('resize', array($file, 400, 400, 'adaptive'))
                //->rotate(array('degree', 180))
                ->reflection(array(40, 40, 80, true, '#a4a4a4'))
                //->save(base_path() . '/', 'aaa.jpg');
                ->show();
        }

    }

^_^

Links