vsivsi / meteor-file-collection

Extends Meteor Collections to handle file data using MongoDB gridFS.
http://atmospherejs.com/vsivsi/file-collection
Other
159 stars 37 forks source link

Show files on meteor 1.3 cordova #118

Open vacarsu opened 8 years ago

vacarsu commented 8 years ago

Hi , in the examples it shows how to show files in cordova in meteor 1.2 (http://meteor.local). Is there any examples for meteor 1.3 which uses localhost:app_id/ ? Doesn't seem to show images out of the box.

Here is my collection -

export var Images = new FileCollection('images', {
  resumable: true,
  baseURL: '/gridfs/images',
  http: [
    {
      method: 'get',
      path: '/:md5',
      lookup: function (params, query) { 
        return { md5: params.md5 };
      }
    }
  ]
});

finding images and trying to display them with <img src="{{'/gridfs/images/'+image.md5}}"/> doesn't work in cordova.

vsivsi commented 8 years ago

Hi, all of the Cordova support has been contributed by users of this package. I'm not a Cordova developer, so I have no ability to develop or test Cordova specific features. As always, I'm open to PRs for this kind of thing...

crapthings commented 8 years ago

@vacarsu

when you can upload file or image on desktop browser, you can easily display image by add below code

{
  method: 'get'
  path: '/:md5'
  lookup: (params, query) ->
    return { md5: params.md5 }
  handler: (req, res, next) ->
    console.log 'get'
    res.setHeader 'Access-Control-Allow-Origin', '*'
    res.setHeader 'Access-Control-Allow-Credentials', true
    do next
}

but the hardiest part is how you can upload image on ios

vsivsi commented 8 years ago

@crapthings Thanks for the info!

crapthings commented 8 years ago

this is a working cordova ios example

https://github.com/crapthings/meteor-photo

the ios can upload file by using input(type='file')

https://github.com/vsivsi/meteor-file-collection/issues/90#issuecomment-207639130