Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

prettify code - formatting, indentation

  • Loading branch information...
commit 89f13e6f84da0d553841b421ffb6f26e22e68d49 1 parent 1b8cbca
@madhums madhums authored
Showing with 27 additions and 29 deletions.
  1. +27 −29 lib/imager.js
View
56 lib/imager.js
@@ -1,18 +1,18 @@
-var formidable = require('formidable'),
- util = require('util'),
- im = require('imagemagick'),
- fs = require('fs'),
- path = require('path'),
- cloudfiles = require('cloudfiles')
-
-var config_file = '../imager-example.json',
- config = {},
- client = undefined,
- container = undefined,
- uploaddir = undefined,
- storage_type = undefined,
- scope = undefined,
- cdnUri = undefined
+var formidable = require('formidable')
+ , util = require('util')
+ , im = require('imagemagick')
+ , fs = require('fs')
+ , path = require('path')
+ , cloudfiles = require('cloudfiles')
+
+var config_file = '../imager-example.json'
+ , config = {}
+ , client = undefined
+ , container = undefined
+ , uploaddir = undefined
+ , storage_type = undefined
+ , scope = undefined
+ , cdnUri = undefined
var Imager = exports = module.exports = function Imager(options) {
@@ -50,10 +50,10 @@ Imager.prototype = {
, remove: function(file, callback, _scope) {
scope = (arguments.length == 3) ? _scope : undefined
- var _variants = this.setupVariants()
- var _resize = _variants['resize']
- var _crop = _variants['crop']
+ var _variants = this.setupVariants()
+ , _resize = _variants['resize']
+ , _crop = _variants['crop']
for(version in _resize) {
eval('this.' + storage_type + 'Remove')( this.genFileName( file, version ), function(err) {
@@ -90,8 +90,6 @@ Imager.prototype = {
, fields = []
, new_file = undefined
- //form.uploadDir = './tmp'
-
form
.on('field', function(field, value) {
fields.push([field, value])
@@ -125,13 +123,12 @@ Imager.prototype = {
, makeVariants: function(file, callback) {
var _this = this
- var _variants = this.setupVariants()
-
- var _resize = _variants["resize"] || JSON.parse( JSON.stringify({"null" : "null"}) )
- var _crop = _variants["crop"] || JSON.parse( JSON.stringify({"null" : "null"}) )
+ , _variants = this.setupVariants()
+ , _resize = _variants["resize"] || JSON.parse( JSON.stringify({"null" : "null"}) )
+ , _crop = _variants["crop"] || JSON.parse( JSON.stringify({"null" : "null"}) )
+ , new_file = Math.round(new Date().getTime())
+ , ext = this.setExtension(file['type'])
- var new_file = Math.round(new Date().getTime())
- var ext = this.setExtension(file['type'])
new_file += ext
var i = 0
@@ -156,7 +153,7 @@ Imager.prototype = {
, setupVariants: function() {
var resize = (typeof scope === 'undefined') ? config.variants.resize : eval('config.variants.'+scope+'.resize')
- var crop = (typeof scope === 'undefined') ? config.variants.crop : eval('config.variants.'+scope+'.crop')
+ , crop = (typeof scope === 'undefined') ? config.variants.crop : eval('config.variants.'+scope+'.crop')
return { "resize" : resize, "crop" : crop }
}
@@ -175,6 +172,7 @@ Imager.prototype = {
, 'Content-Length': buf.length
}
, local: sfile }
+
cdnUri = container.cdnUri
client.addFile(container, options, onUploadToContainer)
}
@@ -205,8 +203,8 @@ Imager.prototype = {
return callback(null)
}
var _this = this
- var dfile = prefix
- var tfile = (storage_type == 'dir') ? uploaddir + dfile : file['path'] + prefix
+ , dfile = prefix
+ , tfile = (storage_type == 'dir') ? uploaddir + dfile : file['path'] + prefix
eval(action)( this.imOptions(file, tfile, size), function(err, stdout, stderr){
if (storage_type == 'rs') {
Please sign in to comment.
Something went wrong with that request. Please try again.