Reputation:
I am working on meteor application.How can I loop to all files instead of one file in profile template.I have successfully uploaded files.But when I fetch according to documentation then it only fetch only one image.And how can I change the directory of upload?? My profile.js file is:
imageFile:function() {
return Images.findOne();
}
My profile.html:
<img src="{{imageFile.link}}" alt="{{imageFile.name}}" />
How can I add image info to other database??
Upvotes: 1
Views: 537
Reputation: 8413
There are a few things to consider when using this package.
But when I fetch according to documentation then it only fetch only one image.
imageFiles() {
return Images.find();
}
{{#each imageFiles}}
<img src="{{this.link}}" alt="{{this.name}}" />
{{/each}}
This is basic template work and you should read more about it in the Blaze documentation.
And how can I change the directory of upload??
storagePath
and downloadRoute
.How can I add image info to other database??
I assume that you mean that external means on another server or app instance. In this case you need to create a Collection, that uses the Mongo external Driver. How to do that is already answered here.
Just make sure, that you have also access to the public directory and that this collection is a collection that stores Files.
You might ask how to access the FilesCollection from this collection:
const ExternalImages = new FilesCollection({
collectionName: 'nameOfExternalCollection',
});
Upvotes: 2