-
-
Save imgsrc/b7a17e2374cd6c30cdd3dbceb07ee989 to your computer and use it in GitHub Desktop.
Image Resize + Watermark + Thumbnails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var src = "___library/7-kazan/1/*"; | |
var dst = "_ready"; | |
var gulp = require('gulp'), | |
imagemin = require('gulp-imagemin'), | |
cache = require('gulp-cache'), | |
del = require('del'), | |
imageResize = require('gulp-image-resize'), | |
watermark = require("gulp-watermark"), | |
rename = require("gulp-rename"); | |
gulp.task('image', ['imagesmall'], function() { | |
return gulp.src(src) | |
.pipe(imageResize({ | |
width : 1920, | |
height : 1080, | |
crop : true, | |
upscale : true | |
})) | |
.pipe(watermark({ | |
image: "watermark.png" | |
})) | |
.pipe(rename(function (path) {path.basename = path.basename.replace('Depositphotos_', '')})) | |
.pipe(rename(function (path) {path.basename = path.basename.replace('_original', '')})) | |
.pipe(cache(imagemin())) | |
.pipe(gulp.dest(dst)); | |
}); | |
gulp.task('imagesmall', function() { | |
return gulp.src(src) | |
.pipe(imageResize({ | |
width : 760, | |
height : 428, | |
crop : true, | |
upscale : true | |
})) | |
.pipe(watermark({ | |
image: "watermark.png" | |
})) | |
.pipe(rename(function (path) {path.basename = path.basename.replace('Depositphotos_', '')})) | |
.pipe(rename(function (path) {path.basename = path.basename.replace('_original', '')})) | |
.pipe(cache(imagemin({progressive: true}))) | |
.pipe(gulp.dest(dst + '/small')); | |
}); | |
gulp.task('clearcache', function () { return cache.clearAll(); }); | |
gulp.task('cleaready', function() { return del.sync(dst); }); | |
gulp.task('default', ['image']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment