0

i have the method to resize in meteor CFS, like the page.

var createThumb = function(fileObj, readStream, writeStream) {
    // Transform the image into a 10x10px thumbnai
    gm(readStream, fileObj.name()).size({ bufferStream: true }, function(err, size){
        if (err) {
            console.log('error parece:');
            console.log(err);
        }
        console.log(size);
        if((size.width * 1.3) >  size.height){
            fileObj.ancho= "ancho";
            this.resize('600').stream().pipe(writeStream);
        }else if((size.height * 1.3) > size.width) {
            fileObj.ancho= "alto";
            this.resize(null, '600').stream().pipe(writeStream);
        }else{
            fileObj.ancho= "cuadrado";           ;
            this.resize(300).stream().pipe(writeStream);

        }
    });
};

how to save the metada fileObj.ancho in the collection?

Levan Lacroix
  • 25
  • 1
  • 8

1 Answers1

0

You should be able to do:

MyFiles.update(fileObj._id,{ $set: {ancho: fileObj.ancho }});

Where MyFiles is the name of your CFS collection.

Michel Floyd
  • 18,793
  • 4
  • 24
  • 39