Closed kimfucious closed 6 years ago
Sorry for the potentially dumb question, but if all I want to do is run through a directory full of image files to produce a bunch of thumbnails, without using
through2
orflat-map
, how would I setup thefiles.scale
object?
You would have to use through2
or flat-map
in your case. gulp-scale-images
does not decide for you how to scale the images; You may use any logic to generate the file.scale
instructions.
The simplest thumbnail generation would probably look like this:
const gulp = require('gulp')
const through2 = require('through2')
const scaleImages = require('gulp-scale-images')
const thumbnail = (file, cb) => {
file.scale = {maxWidth: 200}
cb(null, file)
}
gulp.src('path/to/pictures/*.{jpeg,jpg,png}')
.pipe(through2.obj(thumbnail))
.pipe(scaleImages())
.pipe(gulp.dest(…))
Please reopen if you have additional questions.
Hi there,
I was liking the looks of
gulp-scale-images
overgulp-image-resize
, as it doesn't require gm and it seems well maintained.Sorry for the potentially dumb question, but if all I want to do is run through a directory full of image files to produce a bunch of thumbnails, without using
through2
orflat-map
, how would I setup thefiles.scale
object?Here's my gulp task:
When I run it I get:
I'm sure there's an easy answer to this, but I just couldn't glean this from the docs.
Thanks,
Kim