So I’ve got an already existing collections of uploaded images, and now I’d like to add a new thumbnail size. I know how to resize new images (this is what my 300px thumbnail store looks like)
new FS.Store.GridFS("300", {
mongoUrl: 'mongodb://127.0.0.1:27017/files',
beforeWrite(fileObj) {
return {
name: fixString(fileObj.original.name)
};
},
transformWrite: function(fileObj, readStream, writeStream) {
if(fileObj.meta.domain == setting('company') && /jpe?g|png/.test(fileObj.original.type)){
var size = '300';
gm(readStream).autoOrient().resize(size, size, '^').gravity('Center').extent(size, size).stream('PNG').pipe(writeStream);
}
}
})
But if I create another store, how do I trigger CollectionFS to go through all my old images, resize them and add them to it?