Package Exports
- pkgcloud-image
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pkgcloud-image) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
pkgcloud-image
Image resize and upload by pkgcloud.
Dependencies
Usage
var AWS = require('aws-sdk')
var Image = require('../')
var config = require('./config.json')
var credentials = new AWS.SharedIniFileCredentials({ profile: config.profile })
var image = new Image({
provider: 'amazon',
key: credentials.secretAccessKey,
keyId: credentials.accessKeyId,
region: config.s3.region,
container: config.s3.bucket,
cdn: config.s3.cdn
})
var file = {
path: 'img.jpg',
extension: 'jpg',
mimetype: 'image/jpg'
}
var thumbs = [
{
base: 'test',
prefix: '100x100',
size: [100, 100]
}
]
image.uploads({
file: file,
thumbs: thumbs
}, function (err, result) {
console.log(err, result)
image.delete([
result[0].replace(config.s3.cdn, '')
], function (err) {
console.log(err)
})
})
// config.json
{
"profile": "s3.profile name",
"s3": {
"bucket": "bucketname",
"region": "ap-northeast-1",
"cdn": "https://cdnsubdomain.cloudfront.net/"
}
}
Release History
See the changelog
LICENSE
pkgcloud-image is licensed under the MIT license.