laravel-elixir-image-resize
v1.0.1
Published
Laravel Elixir 3 wrapper around gulp-image-resize Gulp task.
Downloads
12
Maintainers
Readme
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 [email protected]
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"
}