vsivsi / meteor-file-collection

Extends Meteor Collections to handle file data using MongoDB gridFS.
http://atmospherejs.com/vsivsi/file-collection
Other
159 stars 37 forks source link

Making thumbnails for uploaded images? #63

Open pkpowell opened 9 years ago

pkpowell commented 9 years ago

Is there a way to create thumbs?

I have tried this:

imageData = new FileCollection({
  stores: [
    new FS.Store.GridFS("images"),
    new FS.Store.GridFS("thumbs", {
      transformWrite: function(fileObj, readStream, writeStream) {
        // Transform the image into a 10x10px thumbnail
        gm(readStream, fileObj.name()).resize('10', '10').stream().pipe(writeStream);
      }
    }),
  ],

but am unsure what's supposed to happen next. Images still end up in 'fs.files', 'fs.chunks' etc.

Cheers Phil

vsivsi commented 9 years ago

You're mixing up projects. This is file-collection, You seem to be trying to use CollectionFS. Two completely different incompatible packages.

pkpowell commented 9 years ago

Ah crap. For some reason I thought CollectionFS was somehow involved. No chance of creating thumbs with meteor-file-collection then?

vsivsi commented 9 years ago

Sure, See the photo gallery sample app: https://github.com/vsivsi/meteor-file-job-sample-app

rwatts3 commented 9 years ago

Not sure if this is related but out of curiosity, is it possible to store multiple image sizes?

vsivsi commented 9 years ago

You can store anything you want. Just use the metadata to keep track of what is what.