diff --git a/modules/imgur/imgur.js b/modules/imgur/imgur.js index fff0a80..b689190 100644 --- a/modules/imgur/imgur.js +++ b/modules/imgur/imgur.js @@ -79,30 +79,27 @@ var imgur = function(dbot) { '.' + ext[_.random(0, ext.length - 1)]; dbot.db.imgur.totalHttpRequests += 1; var image = request(testUrl, function(error, response, body) { - gm(new Buffer(body, 'binary')).size(function(e, val) { - // 492 is body.length of a removed image - if(!error && response.statusCode == 200 && body.length != 492 && - val && val.height > 300 && val.width > 300) { - dbot.db.imgur.totalImages += 1; - var hash = crypto.createHash('md5').update(body).digest("hex"); - if(_.has(dbot.modules, 'quotes')){ - // autoadd: {"abcdef": "facebookman"} - if(_.has(dbot.config.modules.imgur.autoadd,hash)){ - var category = dbot.config.imgur.autoadd[hash]; - if (_.contains(category, testUrl)){ - // there's probably less than 62^5 chance of this happening - } else { - dbot.api.quotes.addQuote(category, testUrl, - dbot.config.name, function() { }); - } + // 492 is body.length of a removed image + if(!error && response.statusCode == 200 && body.length != 492) { + dbot.db.imgur.totalImages += 1; + var hash = crypto.createHash('md5').update(body).digest("hex"); + if(_.has(dbot.modules, 'quotes')){ + // autoadd: {"abcdef": "facebookman"} + if(_.has(dbot.config.modules.imgur.autoadd,hash)){ + var category = dbot.config.imgur.autoadd[hash]; + if (_.contains(category, testUrl)){ + // there's probably less than 62^5 chance of this happening + } else { + dbot.api.quotes.addQuote(category, testUrl, + dbot.config.name, function() { }); } } - callback(testUrl, testSlug, hash); - } else { - this.api.getRandomImage(callback); } - }.bind(this)); - }.bind(this)); + callback(testUrl, testSlug, hash); + } else { + this.api.getRandomImage(callback); + } + }.bind(this)); }, 'getImageInfoString': function(slug, callback) {