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:
Now what is wrong with this? I am still not seeing any images.