Skip to content

Instantly share code, notes, and snippets.

@laurentlemaire
Last active May 17, 2016 17:10
Show Gist options
  • Save laurentlemaire/1209d519c132f10062fe to your computer and use it in GitHub Desktop.
Save laurentlemaire/1209d519c132f10062fe to your computer and use it in GitHub Desktop.
Gulp setup - 2
var gulp = require('gulp');
var imageResize = require('gulp-image-resize');
var rename = require('gulp-rename');
gulp.task('img-thumb', function () {
return gulp.src('web/galleries/uploads/*/*.jpg')
.pipe(imageResize({
width : 365,
height : 300,
crop : true,
upscale : false
}))
.pipe(gulp.dest('web/galleries/dist/thumb'));
});
gulp.task('img-large', function () {
return gulp.src('web/galleries/uploads/*/*.jpg')
.pipe(imageResize({
width : 1800,
height : 1000,
crop : false,
upscale : false,
sharpen: true
}))
.pipe(gulp.dest('web/galleries/dist/large'));
});
// Called from app
gulp.task('process-img-thumb', function () {
return gulp.src('web/galleries/process/*/*.jpg')
.pipe(imageResize({
width : 365,
height : 300,
crop : true,
upscale : false
}))
.pipe(gulp.dest('web/galleries/dist/thumb'));
});
gulp.task('process-img-large', function () {
return gulp.src('web/galleries/process/*/*.jpg')
.pipe(imageResize({
width : 1800,
height : 1000,
crop : false,
upscale : false,
sharpen: true
}))
.pipe(gulp.dest('web/galleries/dist/large'));
});
gulp.task('default', [], function() {
gulp.start('img-large', 'img-thumb');
});
gulp.task('process-img', [], function() {
gulp.start('process-img-large', 'process-img-thumb');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment