0.0.52 • Published 8 years ago

contentitems v0.0.52

Weekly downloads
144
License
-
Repository
-
Last release
8 years ago

ContentItems [Build Status

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]);
            };
        }
    });
0.0.52

8 years ago

0.0.50

8 years ago

0.0.49

8 years ago

0.0.48

8 years ago

0.0.47

8 years ago

0.0.46

9 years ago

0.0.45

9 years ago

0.0.44

9 years ago

0.0.43

9 years ago

0.0.42

9 years ago

0.0.40

9 years ago

0.0.39

9 years ago

0.0.38

9 years ago

0.0.37

9 years ago

0.0.36

9 years ago

0.0.35

9 years ago

0.0.34

9 years ago

0.0.33

9 years ago

0.0.32

9 years ago

0.0.31

9 years ago

0.0.30

9 years ago

0.0.29

9 years ago

0.0.28

9 years ago

0.0.27

9 years ago

0.0.26

9 years ago

0.0.25

9 years ago

0.0.24

9 years ago

0.0.23

9 years ago

0.0.22

9 years ago

0.0.21

9 years ago

0.0.20

9 years ago

0.0.19

9 years ago

0.0.18

9 years ago

0.0.17

9 years ago

0.0.16

9 years ago

0.0.15

9 years ago

0.0.14

9 years ago

0.0.12

9 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago