Пример #1
0
files.getFullImageUrl = (pathInStore, size = '') => {
    if (size) {
        const paths = pathInStore.match(/^(.*)(\.[^\.\/]*)$/);
        if (paths && paths.length === 3) {
            pathInStore = paths[1] + '.' + size + paths[2];
        }
    }
    return files.getFullFileUrl(pathInStore);
};
Пример #2
0
import {UniCollection, UniUsers} from 'meteor/universe:collection';
import {UniConfig, UniUtils} from 'meteor/universe:utilities';
import {Meteor} from 'meteor/meteor';

const files = new UniCollection('universeFiles');
files.STATUS_START = 'start';
files.STATUS_DONE = 'done';
files.STATUS_PROCESSING = 'processing';
files.STATUS_ERROR = 'error';

const httpRegx = /https?:\/\//;

let confUF;

files.getFullFileUrl = pathInStore => {
    confUF = confUF || UniConfig.public.get('universe:files');
    const {UPLOADS_URL} = confUF || {};
    if (/\/$/.test(UPLOADS_URL)) {
        return UPLOADS_URL + pathInStore;
    }
    let url = UPLOADS_URL + '/' + pathInStore;
    if (httpRegx.test(url)) {
        return url;
    }
    if (url[0] === '/'){
        url = url.substr(1);
    }
    return Meteor.absoluteUrl(url);
};

files.getFullImageUrl = (pathInStore, size = '') => {