Add an app for resizing images. Still needs rate limiting, and still trying to decide how to pass the correct URL to the app.

This commit is contained in:
Simo Kinnunen
2014-05-20 19:00:53 +09:00
parent 9e4dc269a2
commit e56d757cde
7 changed files with 158 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
var RE_CROP = /^([0-9]*)x([0-9]*)$/
module.exports = function(raw) {
var parsed
if (raw && (parsed = RE_CROP.exec(raw))) {
return {
width: +parsed[1] || 0
, height: +parsed[2] || 0
}
}
return null
}

View File

@@ -0,0 +1,21 @@
var GRAVITY = {
northwest: 'NorthWest'
, north: 'North'
, northeast: 'NorthEast'
, west: 'West'
, center: 'Center'
, east: 'East'
, southwest: 'SouthWest'
, south: 'South'
, southeast: 'SouthEast'
}
module.exports = function(raw) {
var parsed
if (raw && (parsed = GRAVITY[raw])) {
return parsed
}
return null
}