connect: function() {
var awsConfig = config.get('s3config');
console.log(awsConfig);
try {
return new Upload(awsConfig.bucket, {
url: awsConfig.url,
aws: {
region: awsConfig.region,
acl: 'public-read',
accessKeyId: awsConfig.accessKey,
secretAccessKey: awsConfig.secretAccessKey,
endpoint: awsConfig.url,
s3BucketEndpoint: true
},
versions: [{
original: false
}, {
suffix: '-large',
quality: 80,
maxHeight: 1040,
maxWidth: 1040,
}, {
suffix: '-medium',
maxHeight: 780,
maxWidth: 780
}, {
suffix: '-small',
maxHeight: 320,
maxWidth: 320
}]
});
} catch (e) {
console.log('error from uploader connect', e);
}
},
upload: function(file, client) {
try {
client.upload(file, {}, function(err, images, meta) {
if (err) {
console.error('Upload Error', err);
} else {
for (var i = 0; i < images.length; i++) {
console.log('Thumbnail with width %i, height %i, at %s', images[i].width, images[i].height, images[i].url);
}
}
});
} catch (e) {
console.log('error from upload', e);
}
}