Skip to content

Commit

Permalink
Pass settings around to allow multiple instances
Browse files Browse the repository at this point in the history
  • Loading branch information
honza committed Jan 3, 2012
1 parent 5fd4753 commit a964a96
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/thumbnail.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var im = require('imagemagick');
var async = require('async');
var _ = require('underscore');

var options, settings, queue, defaults, done;
var options, queue, defaults, done;

defaults = {
suffix: '_thumb',
Expand All @@ -31,7 +31,7 @@ var extensions = [
];


var createQueue = function() {
var createQueue = function(settings) {

queue = async.queue(function (task, callback) {

Expand Down Expand Up @@ -81,13 +81,13 @@ var createQueue = function() {
};


var run = function() {
var run = function(settings) {
var images = fs.readdirSync(settings.source);
images = _.reject(images, function(file) {
return _.indexOf(extensions, path.extname(file)) === -1;
});

createQueue();
createQueue(settings);

_.each(images, function(image) {

Expand All @@ -105,6 +105,8 @@ var run = function() {


exports.thumb = function(options, callback) {
var settings;

if (options.args) {

if (options.args.length != 2) {
Expand Down

0 comments on commit a964a96

Please sign in to comment.