0

This is an attempt of uploading and displaying pictures using gridfs.

This is placed on both server and client:

var imageStore = new FS.Store.GridFS("images", {});
Images = new FS.Collection("images", {
  stores: [imageStore],
  filter: {
    maxSize: 6048576 // in bytes
  }
});

Images.allow({
  insert: function () {
    return true;
  },
  update: function () {
    return true;
  },
  download: function () {
    return true;
  }
});

Template:

<template name="imageView">
    <div class="imageView">
        {{#each images}}
        <div>
            <img src="{{this.url store='images'}}" alt="" class="thumbnail" />
        </div>
        {{/each}}
    </div>
</template>

helper for this template:

Template.imageView.helpers({
  images: function () {
    return Images.find(); // Where Images is an FS.Collection instance
  }
});

I publish the images collection:

Meteor.publish("images", function () {
  return Images.find({});
});

I subscribe to these images in my route:

waitOn: function () {
  return this.subscribe('images');
}

Most of this is copy pasted from collectionFS github page but it still does not show any images. This is how it looks in my DB after having had an image uploaded:

image1 image2 image3

Now what is wrong with this? I am still not seeing any images.

Gravity123
  • 1,130
  • 3
  • 21
  • 39

1 Answers1

0

Your store name is registrationStorage and your collection name is registrations. Try changing the second line of your second snippet to:

 <img src="{{this.url store="registrationStorage"}}" /><br />
Bart Louwers
  • 873
  • 9
  • 28
  • if I change it to "registrationStorage" then the tag won't show in the pages source at all. – Gravity123 Aug 04 '15 at 20:24
  • 1
    Does it if you provide it with a random store name? There might be a problem with cfs:dropbox... The GitHub page says it is not ready for production yet, and that it still has bugs. I am using sfs:gridfs and it works briliantly, so consider using that if it is an option for you. – Bart Louwers Aug 05 '15 at 23:24
  • I edited my post to what I use with gridfs and it's still not working. I'm having the same problem. – Gravity123 Aug 08 '15 at 13:45
  • no wait, I just tried this on my mac laptop and it works, it just does not work on the windows pc. – Gravity123 Aug 08 '15 at 14:37