Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/442.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript FS.Store.GridFS createdByTransform:false_Javascript_Angularjs_Node.js_Meteor_Angular Meteor - Fatal编程技术网

Javascript FS.Store.GridFS createdByTransform:false

Javascript FS.Store.GridFS createdByTransform:false,javascript,angularjs,node.js,meteor,angular-meteor,Javascript,Angularjs,Node.js,Meteor,Angular Meteor,我正在尝试保存正在使用的图像文件 但是失败了。 图像模型 /** * Create collections Images * @type {FS.Collection} */ Images = new FS.Collection("images", { stores: [ /** * Use GridFS stores */ new FS.Store.GridFS("original"), new

我正在尝试保存正在使用的图像文件

但是失败了。 图像模型

/**
 * Create collections Images
 * @type {FS.Collection}
 */
Images = new FS.Collection("images", {
    stores: [
        /**
         * Use GridFS stores
         */
        new FS.Store.GridFS("original"),
        new FS.Store.GridFS("thumbnail", {
            transformWrite: function(fileObj, readStream, writeStream) {
                gm(readStream, fileObj.name()).resize('32', '32', '!').stream().pipe(writeStream);
            }
        })
    ],
    filter: {
        allow: {
            contentTypes: ['image/*']
        }
    }
});
下一步,在控制器中保存图像

this.saveCroppedImage = () => {
                if (this.myCroppedImage !== '') {
                    Images.insert(this.myCroppedImage, (err, fileObj) => {
                        if (!this.newParty.images) {
                            this.newParty.images = [];
                        }

                        console.log(fileObj);

                        this.newParty.images.push(fileObj);
                        this.cropImgSrc = undefined;
                        this.myCroppedImage = '';
                    });
                }
            };

fileObj没有url()方法。若尝试获取图像链接,则捕获503错误。但是如果在浏览器中放置链接-图像存在

如果使用angular meteor和图像。收藏中存在id-不订阅收藏图像-在客户端上使用此功能

var getImageLink = function (imageId, store = "thumbnail") {
            var authToken = FS.Utility.btoa(JSON.stringify({
                authToken: Accounts._storedLoginToken() || '',
            }));
            return "/cfs/files/images/"+imageId+"?token="+authToken+"&store="+store;
        }

如果您使用angular meteor和image.\u id存在于集合中-不订阅集合图像-请在客户端上使用此功能

var getImageLink = function (imageId, store = "thumbnail") {
            var authToken = FS.Utility.btoa(JSON.stringify({
                authToken: Accounts._storedLoginToken() || '',
            }));
            return "/cfs/files/images/"+imageId+"?token="+authToken+"&store="+store;
        }