collections - Get file URL of a FS.File object with Meteor -
collections - Get file URL of a FS.File object with Meteor -
i'm using meteor's collectionfs , trying display image files uploaded server. i've attached reference file objects in object, such:
entries.insert({ title: title, caption: caption, file: fsfile, }); i phone call entries.find({}) , homecoming template, utilize iterate through entries. i've tried <img src="file.url">, doesn't work.
it works fine if phone call images collection directly, images.find({}), , iterate through files, getting urls file context this.url. there similar way using references in entires objects?
try this: (note i'm using underscore package)
template.image_queue.helpers({ images: function() { homecoming _.map(images.find().fetch(), function(image) { homecoming image.url(); }); } }); asuming
images = new fs.collection("images", { stores: [new fs.store.filesystem("images", { path: "~/uploads" })] }); images.allow({ insert: function (userid, party) { homecoming true; }, update: function (userid, party) { homecoming true; }, remove: function (userid, party) { homecoming true; }, download: function (userid, party) { homecoming true; } }); url collections meteor meteorite
Comments
Post a Comment