mewebstudio / Phpthumb by mewebstudio

PHPThumb Package for Laravel 4
1,172
13
3
Package Data
Maintainer Username: mewebstudio
Maintainer Contact: me@mewebstudio.com (Muharrem ERIN)
Package Create Date: 2013-03-21
Package Last Update: 2014-12-31
Language: PHP
License: MIT
Last Refreshed: 2024-03-26 03:15:31
Package Statistics
Total Downloads: 1,172
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 13
Total Watchers: 3
Total Forks: 2
Total Open Issues: 0

PHPThumb for Laravel 4

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