New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

imager

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imager

Easy way to resize, crop and upload images to Rackspace cloudfiles

  • 0.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-42.86%
Maintainers
1
Weekly downloads
 
Created
Source

Imager

A Node.js module to easily resize, crop and upload images to Rackspace cloudfiles. Possible to add different versions of the same file in cropped or resized variant.

Installation

$ npm install imager

Usage

You need to create imager configuration file with image variants and your storages

Example config with scopes:

{
  "variants": {
    "projects": {
      "resize": {
        "mini" : "300x200",
        "preview": "800x600"
      },
      "crop": {
        "thumb": "200x200"
      }
    },

    "gallery": {
      "crop": {
        "thumb": "100x100"
      }
    }
  },

  "storage": {
    "rs": {
      "auth": {
        "username": "USERNAME",
        "apiKey": "API_KEY",
        "host": "lon.auth.api.rackspacecloud.com"
      },
      "container": "CONTAINER_NAME"
    }
  }
}

Now you can use Imager

var  Imager = require('imager');
var imager = new Imager({storage : "rs", config_file: "path_to_imager_config.json"})

Note: More storage systems yet to come

UPLOAD FILE

Upload example:

app.get('/upload_form', function(req, res) {
  res.writeHead(200, {'content-type': 'text/html'});
  res.end(
    '<form action="/upload_form" enctype="multipart/form-data" method="post">'+
    '<input type="text" name="title"><br>'+
    '<input type="file" name="image"><br>'+
    '<input type="submit" value="Upload">'+
    '</form>'
  );
});

app.post('/upload',  function(req, res) {
  //With Scope `items` (look at example of configuration file)
  imager.upload(req, res, function(err, files, cdnUri, res){
    console.log({ uri : cdnUri, files : files });
    res.end()
  }, 'items')
});

REMOVE FILE

imager.remove('1330838831049.png', function (err) {
  if (err) throw err
  console.log('removed')
}, 'projects')

To-do's

  • Support amazon storage
  • Support filesystem storage
  • Remove using of eval
  • Add functionality to remove files
  • Add functionality to get the image url
  • Add functionality to get remote images, process the image and then upload to various storage systems
  • Write tests

Many Thanks to Alleup

Keywords

FAQs

Package last updated on 04 Mar 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc