2016-07-13 63 views
0

我使用這些包如何顯示數組的圖像?

aldeed:collection2,

aldeed:autoform,

cfs:standard-packages,

yogiben:autoform-file,

cfs:filesystem.

{{#with FS.GetFile "images" pictures}} 
     <img src="{{this.url}}" alt="" class="card-img-bottom"> 
     {{/with}} 

Images = new FS.Collection("images",{ 
    stores: [new FS.Store.FileSystem("images")], 
    filter:{ 
    allow:{ 
     contentTypes: ['image/*'] 
    } 
    } 
}); 
Images.allow({ 
    insert: function(userId,fileObj){ 
    return true; 
    }, 
    update:function(userId,fileObj){ 
    return true; 
    }, 
    download: function(userId,fileObj){ 
    return true; 
    } 
}); 
Posts = new Mongo.Collection('posts'); 

Posts.allow({ 
    insert:function(userId,fileObj){ 
    return true; 
    }, 
    update:function(userId,fileObj){ 
    return true; 
    } 
}); 
PostSchema = new SimpleSchema({ 
    title:{ 
    type: String, 
    autoform:{ 
     label:false, 
     type:"textarea", 
     placeholder:"Comparte con la comunidad" 
    } 
    }, 
    pictures:{ 
    type:[String], 
    optional: true, 
    label: " " 
    }, 
    'pictures.$':{ 
    autoform:{ 
     type:"fileUpload", 
     collection: 'images', 
     selectFileBtnTemplate: 'mySelectFileBtn', 
     previewTemplate: 'myFilePreview', 
     uploadProgressTemplate: 'myUploadProgressTemplate' 
    } 
    }, 
    author:{ 
    type:String, 
    label: "Author", 
    autoValue: function(){ 
     return this.userId 
    }, 
    autoform:{ 
     type:"hidden" 
    } 
    }, 
    createdAt:{ 
    type: Date, 
    label: "created At", 
    autoValue:function(){ 
     return new Date() 
    }, 
    autoform:{ 
     type:"hidden" 
    } 
    } 
}); 
Posts.attachSchema(PostSchema); 

我有這樣的錯誤

Exception in queued task: Error: Invalid selector: tzYd8ocD9xhvCCfk7

當它不是數組,如果畫面顯示

非常感謝您的幫助。

回答

0

您提供的信息並不顯示您如何發佈圖像,因此您可能也想展示這些圖像?

+0

如果我想顯示已上傳的圖像 –

+0

您需要將圖像發佈到服務器上並在客戶端上訂閱它們,然後才能顯示它們 –