Namespace, Primitive, Method

    laravel-elixir-image-resize

    1.0.1 • Public • Published

    laravel-elixir-image-resize

    This is a simple image-resize wrapper around Laravel Elixir 3. Add it to your Elixir-enhanced Gulpfile, like so:

    Install

    Install with npm

    npm install --save-dev laravel-elixir-image-resize
    

    For Elixir 2.* compatibility, install version 0.3.1

    npm install --save-dev laravel-elixir-image-resize@0.3.1
    

    Requires GraphicsMagick or ImageMagick

    Make sure GraphicsMagick or ImageMagick is installed on your system and properly set up in your PATH.

    See gulp-image-resize installation instructions for your favorite operating system

    Usage

    Example Resize Gulpfile:

    var elixir = require('laravel-elixir');
     
    require('laravel-elixir-image-resize');
     
    elixir(function(mix) {
       mix.imageresize({ width:1200, height:750 });
    });

    This will resize all image files in resources/assets/images to the specified width and height and write the output to the default public/images folder. All arguments supported by gulp-image-resize apply.

    Example with Resize and Rename:

    mix.imageresize({ width:1200, height:750 }, { suffix: '-lg'});

    This will resize all image files in resources/assets/images and add the suffix -lg to the resized filename. All arguments supported by gulp-rename apply.

    Examples with different source folder:

    //resize, reformat & add suffix using a specific file
    mix.imageresize({ width:1200, height:750 }, { suffix: '-lg'}, './resources/assets/img/banner.png');
     
    //resize, reformat & add suffix using files from alternate folder
    mix.imageresize({ width:1200, height:750, format:'png' }, { suffix: '-lg'}, './resources/assets/img');
     
    //resize, reformat, but no rename using files from alternate folder
    mix.imageresize({ width:1200, height:750 }, null, './resources/assets/img');

    Examples with different output folder:

    mix.imageresize({ width:1200, height:750 }, { suffix: '-lg'}, './resources/assets/img', 'public/img');

    Change Default Image Directory

    Change the default image directory in elixir config. Do that in your Gulpfile like so:

    elixir.config.imagePath = 'own-image-folder';

    or in elixir.json:

    {
        "imagePath": "your-img-folder"
    }

    License

    MIT license

    Install

    npm i laravel-elixir-image-resize

    DownloadsWeekly Downloads

    2

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • y-node