nckg/imageme

There is no license information available for the latest version (0.1.2) of this package.

Image resizing on the fly - with caching

0.1.2 2014-10-10 19:35 UTC

This package is auto-updated.

Last update: 2024-04-27 00:33:23 UTC


README

Travis CI Latest Stable Version

Installation

Simply add a dependency on nckg/imageme to your project's composer.json file if you use Composer to manage the dependencies of your project.

{
    "require-dev": {
        "nckg/imageme": "dev-master"
    }
}

Usage

This is an example for Laravel.

Route::get('/my_image_path/{modifiers}/{src}', function($modifiers, $src)
{
    $directory = Config::get('upload.display_path');
    $imageMe = new \Nckg\ImageMe\ImageMe;
    
    // optional: save to the filesystem
    $storage = new \Nckg\ImageMe\Storage\FileSystem($directory.DIRECTORY_SEPARATOR.$modifiers, $src);
    $imageMe->addStorage($storage);

    // resize
    $image = $imageMe->make($directory, $src, $modifiers);
    
    // return image response
    return $image->response();
})
    ->where('modifiers', '^((w|h)\d+(\-?))+$')
    ->where('src', '.*\.(?:jpg|gif|png|jpeg)$');

Development

Use terminal to go inside the example directory. Once inside the directory fire up the built-in web server with php -S 0.0.0.0:1337. Use your browser to navigate to http::0.0.0.0:1337.

License

MIT license