Huge News!Announcing our $40M Series B led by Abstract Ventures.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.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
51
increased by30.77%
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

Checkout the example config file imager-example.json in the repo

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

Uploading file(s)

The callback recieves an err object, a files array (containing the names of the files which were uploaded) and the cdnUri.

So if you have a variant, say thumb, then you can access the image by cdnUri+'/'+'thumb_'+files[0]. This would be the complete url of the image

  1. Form upload
imager.upload(req, function(err, files, cdnUri){
    // do your stuff
}, 'projects')
  1. Upload files from disk

You can upload a single file or multiple files by providing the paths to all the files in an array

Upload Single file from disk:

imager.upload('path/to/file.jpg', function(err, files, cdnUri){
    // do your stuff
}, 'projects')

Upload multiple files from disk:

var files = ['file1.jpg', 'file2.jpg']
imager.upload(files, function(err, files, cdnUri){
    // do your stuff
}, 'projects')
  1. Upload files from remote url
imager.uploadRemoteImage('https://www.google.co.in/images/srpr/logo3w.png', function(err, files, cdnUri){
    // do your stuff
}, 'projects')

Removing file(s)

  1. Remove a single file
imager.remove('1330838831049.png', function (err) {
    // do your stuff
}, 'projects')
  1. Remove multiple files
var files = ['1330838831049.png', '1330838831049.png']
imager.remove(files, function (err) {
    // do your stuff
}, 'projects')

To-do's

  • Support amazon storage
  • Support filesystem storage
  • Remove using of eval
  • Add functionality to remove files
  • Write tests

Keywords

FAQs

Package last updated on 04 Aug 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