Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 21 09:42
    make-github-pseudonymous-again opened #808
  • Jun 18 14:19
    make-github-pseudonymous-again commented #786
  • Jun 18 14:17
    make-github-pseudonymous-again commented #786
  • Jun 17 09:03
    tjaisson opened #807
  • Jun 14 13:40
    Saeeed-B opened #806
  • Jun 02 20:40
    ajaypillay edited #805
  • Jun 02 20:40
    ajaypillay edited #805
  • Jun 02 20:29
    ajaypillay edited #805
  • Jun 02 20:28
    ajaypillay edited #805
  • Jun 02 20:28
    ajaypillay edited #805
  • Jun 02 20:28
    ajaypillay edited #805
  • Jun 02 20:27
    ajaypillay opened #805
  • Jun 02 18:30
    naschpitz commented #796
  • Jun 02 17:58
    dr-dimitru commented #796
  • May 31 15:04
    ajaypillay opened #804
  • May 31 13:04
    bartenra opened #803
  • May 30 19:24
    imongithubnow commented #796
  • May 30 08:57
    dr-dimitru commented #796
  • May 30 06:25
    imongithubnow commented #796
  • May 30 06:24
    imongithubnow commented #796
distalx
@distalx
When I upload base64 string, would it store the image in the MongoDB itself or Images are still being stored on the server dir?
distalx
@distalx
Okay, I figured it out. it images are still getting stored on disk.
dr.dimitru
@dr-dimitru
Just got your message, yes, by default everything goes to disk, even with gridfs integration
bmartin1134
@bmartin1134
is it possible to upload directly to amazon s3, similar to slingshot. from the docs it seems like i need to upload to the server first
dr.dimitru
@dr-dimitru
@bmartin1134 no, not possible. Yes, got to upload to the server first.
thespacecowboys45
@thespacecowboys45
I am trying to create a gallery of uploaded images. I am stuck trying to iterate over all images and display the image on the page using the "imageFile.link" helper.
    'files': function() {
        console.log("files()");

        var files = Images.find({}).cursor;

        for (file in files) {
            console.log("FILE:",file);
            console.log("link = " + file.link());
        }


        return files;
and the Template:
<template name="files">
    <h1>Files:</h1>
    <ul>
    {{#each files}}
        <li>{{ name }} - {{ imageFile.link }} <textarea>{{ tostring this }}</textarea></li>
    {{/each}}
    </ul>
</template>
So, how am I properly to use the Images collection - I think I am missing something about how the collection differs from a "standard" mongo collection - it seems there are other functions built in : like "link()"
SO I'm trying to understand that aspect of it.
Hmm....reading this
dr.dimitru
@dr-dimitru
@thespacecowboys45 .find() would return filesCursorhttps://github.com/veliovgroup/Meteor-Files/wiki/FilesCursor
Template.files.helpers({
    files() {
        console.log("files()");

        var files = Images.find({});

        for (file in files.fetch()) {
            console.log("FILE:",file);
            console.log("link = " + file.link());
        }


        return files;
<template name="files">
    <h1>Files:</h1>
    <ul>
    {{#each files.each}}
        <li>{{ name }} - {{ link }} <textarea>{{ tostring this }}</textarea></li>
    {{/each}}
    </ul>
</template>
thespacecowboys45
@thespacecowboys45
I ended up with this:
Template.files.helpers({
    'files': function() {
        var files = Images.find({}, { sort: { _id: 1 }}).cursor;

        return files;
    },
and
<template name="files">
    <h1>Files:</h1>
    <button>Click me</button>
    <ul>
    {{#each files}}
        <li>{{ name }} - {{ imageLink _id }} - <img class="size_thumb" src="{{ imageLink _id }}" /> <textarea>{{ tostring this }}</textarea></li>
    {{/each}}
    </ul>
</template>
and then another helper function to lookup and return the FileCursor :::
    imageLink(id) {
        console.log("imageLink for: " + id);
        path = Images.findOne({_id:id}).link();
          return path;
    },
dr.dimitru
@dr-dimitru
@thespacecowboys45 looks a little overcomplicated with .findOne() method call, which is unnecessary
kakadais
@kakadais

I think I understand what @thespacecowboys45 says.

The document explains the usage,

Images.collection.find({}).forEach(function (fileRef) {
  Images.link(fileRef);
});

And I used to get the links in cursor something like this to be clear for my co-workers (not familiar on this library).

Images.collection.find({}).forEach(function (fileRef) {
  Images.findOne(fileRef._id).link()
});

But it could be better and clear if we could get a link on fileRef or cursor directly.

Images.collection.find({}).forEach(function (fileRef) {
    fileRef.link()
});

I know there would be proper reason not to be accomplished this,
but I still think that would be good to be understood for new people.

Could it be?
Cheer up man - haha ;)

dr.dimitru
@dr-dimitru

But it could be better and clear if we could get a link on fileRef or cursor directly.

And you can:

Images.collection.find({}).each(function (fileCursor) {
    fileCursor.link()
});

And I used to get the links in cursor something like this to be clear for my co-workers (not familiar on this library).

Better to add reference to the docs right in the in-code docs, than running expensive .findOne

kakadais
@kakadais
Do you suggest this way?
each() returns cursor array and there's no callback.
Images.find().each().forEach (cursor) -> cl cursor.link()
kakadais
@kakadais
I realize forEach contains object, and Meteor collection forEach as well.
But I suggest that it would be great if the object contains the link or link() method in the object just like a data if it's possible-
Malte Engelhardt
@kurvenschubser1_gitlab
Hi, I'd like to insert zip files generated on the server side to a Meteor-Files collection, but I get an error that 'CaseFiles.insert is not a function'. Is this by design? But how do you save a file on the server?
dr.dimitru
@dr-dimitru
@kurvenschubser1_gitlab .insert() (e.g. upload) is Client only method. Look at .addFile() and .write() Server-only methods
Malte Engelhardt
@kurvenschubser1_gitlab
@dr-dimitru Works great, thanks a bunch!