Skip to content

Commit 7ba546d

Browse files
committed
Added :size endpoint
1 parent 03f530a commit 7ba546d

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/lib/imager.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ const _parseSize = (size) => {
2222
};
2323

2424
export const combine = (face, size, callback) => {
25-
if (callback) { size = _parseSize(size); }
25+
if (size) { size = _parseSize(size); }
2626
else {
27-
callback = size;
2827
size = { width: maxSize, height: maxSize };
2928
}
3029

src/routes/avatars.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ router.get('/list', function(req, res) {
3131
});
3232

3333
router.get('/:id', function(req, res, next) {
34-
return combine(req.faceParts, function(err, stdout) {
34+
return combine(req.faceParts,false, function(err, stdout) {
3535
return common.sendImage(err, stdout, req, res, next);
3636
});
3737
});
@@ -42,7 +42,7 @@ router.get('/:size/:id', function(req, res, next) {
4242
});
4343
});
4444

45-
router.get('/face/:eyes/:nose/:mouth/:color', function(req, res, next) {
45+
router.get('/face/:eyes/:nose/:mouth/:color/:size?', function(req, res, next) {
4646
let faceParts = { color: '#' + req.params.color };
4747

4848
partTypes.forEach(function(type) {
@@ -61,7 +61,7 @@ router.get('/face/:eyes/:nose/:mouth/:color', function(req, res, next) {
6161
faceParts[type] = pathFor(type, fileName);
6262
});
6363

64-
return combine(faceParts, function(err, stdout) {
64+
return combine(faceParts, req.params.size, function(err, stdout) {
6565
return common.sendImage(err, stdout, req, res, next);
6666
});
6767
});

0 commit comments

Comments
 (0)