Skip to content

nckg/imageme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Me

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

About

Image resizing on the fly - with caching

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages