contentitems v0.0.52
ContentItems [
ContentItems
storage for Images/Audio/Video
Setting up the client
The constructor of the contentitems
client take 2 different arguments ServerConfig
(local storage or S3 storage) and options
. Syntax:
Example of config for the Local Storage: {type: 'local', dir: '../contentitems/'}
Example of config for the Amazon S3 Storage: {type: 's3', bucket: 'contentitems_1433571935989', credentials: {accessKeyId: 'your_accessKeyId', secretAccessKey: 'your_secretAccessKey'}}
Image resizing:
- if you do not need image resizing, just leave image_resizes empty (e.e. {image_resizes:[]})
- otherwise fill it:
{image_resizes: [{name: 'halfxhalf', width: 50, height: 50, resize_type: '%'} // < - resizes the image only if both of its dimensions are less than the geometry specification
// > - to change the dimensions of the image only if its width or height exceeds the geometry specification
// % - specify a percentage width or height instead
, {name: '100x100', width: 100, height: 100, resize_type: '!'} // ! - override proportion
, {name: '640x', width: 640, height: null}
, {name: 'x500', width: null, height: 500}
, {name: 'thumb', width: 200, height: 200, resize_type: 'thumb', bgcolor: 'transparent'}
}
var ContentItems = require('contentitems');
var contentitems = new ContentItems({type: 'local', dir: '../contentitems/'}, {image_resizes: [{name: '250x250', width: 250, height: 250, resize_type: '!'}
,{name: '640x', width: 640, height: null}
,{name: 'thumb', width: 200, height: 200, resize_type: 'thumb', bgcolor: 'transparent'}
]
});
contentitems.upload_content_item(req, function(err, data){
if(typeof data.data != 'undefined' && typeof data.data.content_items != 'undefined'){
for(i in data){
console.log('RESULT['+i+']:', data[i].result);
}
}
});
contentitems.get_content_item_info(req, function(err, data){
if(typeof data.data != 'undefined' && typeof data.data.content_items != 'undefined'){
for(i in data.data.content_items){
console.log('RESULT['+i+']:', data.data.content_items[i]);
};
}
});
contentitems.delete_content_item(req, function(err, data){
if(typeof data.data != 'undefined' && typeof data.data.content_items != 'undefined'){
for(i in data.data.content_items){
console.log('RESULT['+i+']:', data.data.content_items[i]);
};
}
});
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago