0.0.52 • Published 7 years ago

contentitems v0.0.52

Weekly downloads
144
License
-
Repository
-
Last release
7 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

7 years ago

0.0.50

7 years ago

0.0.49

7 years ago

0.0.48

7 years ago

0.0.47

7 years ago

0.0.46

7 years ago

0.0.45

8 years ago

0.0.44

8 years ago

0.0.43

8 years ago

0.0.42

8 years ago

0.0.40

8 years ago

0.0.39

8 years ago

0.0.38

8 years ago

0.0.37

8 years ago

0.0.36

8 years ago

0.0.35

8 years ago

0.0.34

8 years ago

0.0.33

8 years ago

0.0.32

8 years ago

0.0.31

8 years ago

0.0.30

8 years ago

0.0.29

8 years ago

0.0.28

8 years ago

0.0.27

8 years ago

0.0.26

8 years ago

0.0.25

8 years ago

0.0.24

8 years ago

0.0.23

8 years ago

0.0.22

8 years ago

0.0.21

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.12

8 years ago

0.0.10

8 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago